CondBroadcast

FreeBASIC

CondBroadcast
 
Restarts all threads CondWaiting for the handle

Syntax

Declare Sub CondBroadcast ( ByVal handle As Any Ptr )

Usage

CondBroadcast ( handle )

Parameters

handle
The handle of a conditional variable, or the null pointer (0) on failure.

Description

Once the conditional is CondCreate and the threads are started, one of more of them (including the main thread executing main program) can be set to CondWait for the conditional, they will be stopped until some other thread CondSignals that the waiting thread can restart. CondBroadcast can be used to restart all threads waiting for the conditional. At the end of the program CondDestroy must be used to avoid leaking resources in the OS.

Condbroadcast must be used instead of CondSignal to restart all threads waiting on the conditional.

Example
Platform Differences

  • Condbroadcast is not available with the DOS version / target of FreeBASIC, because multithreading is not supported by DOS kernel nor the used extender.
  • In Linux the threads are always started in the order they are created, this can't be assumed in Win32. It's an OS, not a FreeBASIC issue.

Dialect Differences

Differences from QB

  • New to FreeBASIC

See also