Class threads.thread.cond

Create and manipulate lua thread wait conditions (pthread_cond)

Functions

new ( ) Create a new wait conditon
wait ( cond ) Wait for a signal on wait condition
timedwait ( cond, sec, nsec ) Wait for a signal on a wait condition with a timeout
signal ( cond ) Signal a wait condtion to notify thread waiting on it
brodcast ( cond ) Brodcast signal to multiple threads waitng on wait conditon
destroy ( cond ) Destroy an initialized wait contion to free resources


Functions

new ( )
Create a new wait conditon (pthread_cond)

Usage:

This function cannot fail and will never return nil.

Return value:

An intialized wait condtion
wait ( cond )
Wait for a signal on wait condition

Parameters

  • cond: An initialized wait condition

Usage

Return values:

1 while waiting, 0 once signal is recieved
timedwait (cond, sec, nsec)
Wait for a signal on wait condition

Parameters

  • cond: Initilized wait condition
  • sec: Seconds to wait (optional)
  • nsec: Nanoseconds to wait (optional)

Usage

Return values:

1 while waiting, 0 once signal is recieved, or ETIMEDOUT (110) on timeout
signal ( cond )
Signal a wait condtion to notify thread waiting on it

Parameters

  • cond: Wait condtion to signal.

Usage:

Return value:

0 success, 1 on failure.
brodcast ( cond )
Brodcast signal to multiple threads waitng on wait conditon

Parameters

  • cond: Wait condtion to brodcast

Usage:

Return value:

0 success, 1 on failure.
destroy ( cond )
Destroy an initialized wait contion to free resources

Parameters

  • cond: Wait condition to destroy

Usage:

Return value:

0 success, 1 on failure.

Valid XHTML 1.0!