PPL C Language Interface 1.2

- Main Page
- Related Pages
- Modules
- Classes

Functions
Timeout Handling

## Functions
int | ppl_set_timeout (unsigned csecs)
| Sets the timeout for computations whose completion could require an exponential amount of time. More...
int | ppl_reset_timeout (void)
| Resets the timeout time so that the computation is not interrupted.
int | ppl_set_deterministic_timeout (unsigned long unscaled_weight, unsigned scale)
| Sets a threshold for computations whose completion could require an exponential amount of time. More...
int | ppl_reset_deterministic_timeout (void)
| Resets the deterministic timeout so that the computation is not interrupted.

## Detailed Description

Functions for setting and resetting timeouts.

## Function Documentation

int ppl_set_timeout | ( | unsigned | csecs | ) |

Sets the timeout for computations whose completion could require an exponential amount of time.

Parameters

  csecs | The number of centiseconds sometimes after which a timeout will occur; it must be strictly greater than zero.

Computations taking exponential time will be interrupted some time after `csecs` centiseconds have elapsed since the call to the timeout setting function. If the computation is interrupted that way, the interrupted function will return error code `PPL_TIMEOUT_EXCEPTION`. Otherwise, if the computation completes without being interrupted, then the timeout should be reset by calling `ppl_reset_timeout()`.

int ppl_set_deterministic_timeout | ( | unsigned long | unscaled_weight,
|  | unsigned | scale
| ) |  |

Sets a threshold for computations whose completion could require an exponential amount of time.

Returns
  `PPL_ERROR_INVALID_ARGUMENT` if `unscaled_weight` is zero or if the computed weight threshold exceeds the maximum allowed value.

Parameters

  unscaled_weight | The unscaled maximum computational weight; it has to be non-zero.
  scale | The scaling factor to be applied to `unscaled_weight`.

If `unscaled_weight` has value and `scale` has value , then the (scaled) weight threshold is computed as . Computations taking exponential time will be interrupted some time after reaching the complexity threshold . If the computation is interrupted that way, the interrupted function will return error code `PPL_TIMEOUT_EXCEPTION`. Otherwise, if the computation completes without being interrupted, then the deterministic timeout should be reset by calling `ppl_reset_deterministic_timeout()`.

Note
  This "timeout" checking functionality is said to be deterministic because it is not based on actual elapsed time. Its behavior will only depend on (some of the) computations performed in the PPL library and it will be otherwise independent from the computation environment (CPU, operating system, compiler, etc.).

Warning
  The weight mechanism is under beta testing. In particular, there is still no clear relation between the weight threshold and the actual computational complexity. As a consequence, client applications should be ready to reconsider the tuning of these weight thresholds when upgrading to newer version of the PPL.