| gclib 1.34.15 Communications API for Galil controllers and PLCs |

## ◆ GWaitForBool()

GReturn GCALL GWaitForBool | ( | GCon | g,
|  | GCStringIn | predicate,
|  | int | trials
| ) |  |

Blocking call that returns when the controller evaluates the predicate as true.

Polls the message command (MG) to check the value of predicate. Polling will continue until the controller responds with a nonzero value or the number of polling trials is reached.

The amount of time until the function fails with G_GCLIB_POLLING_FAILED is roughly (trials * POLLINGINTERVAL) milliseconds.

Parameters

  g | Connection's handle.
  predicate | A null-terminated string containing the predicate to be polled. The predicate will be enclosed in parentheses and used in the command `MG (predicate)` to return the value.
  trials | The number of polling cycles to perform looking for a nonzero value. Use -1 to poll indefinitely.

Returns
  The success status or error code of the function. See gclib_errors.h for possible values.

See GMotionComplete() for an example.

Definition at line 318 of file gclibo.c.

References G_GCLIB_POLLING_FAILED, G_LINE_BUFFER, G_NO_ERROR, G_SMALL_BUFFER, GCommand(), GSleep(), and POLLINGINTERVAL.

Referenced by GMotionComplete().