Signals

Signals are used as a synchronization mechanism. They are used for signaling other tasks that a certain event has occurred. Signals correspond to Event objects in Win32.

For example, one thread can create a signal to wait for arriving messages.

    #include <oops/r3signal.h>

    signal = R3New(R3CLID_SIGNAL,
                   R3TAG_END);

    for(;;) {
        /* wait (sleep) until somebody signals us up */
        R3DoA(signal, R3SIGM_WAIT, NULL);

        /* somebody wants us to do something */
        ...
    }

The sender task code might look as follows:

    /* prepare data for the thread */
    ...

    /* wake up the thread */
    R3DoA(signal, R3SIGM_SET, NULL);