EVENTSET: eventset_stop() - instructs the worker thread to end

Name

eventset_stop()

Synopsis

#include "eventset.h"
err_t eventset_stop(EVENTSET *evs)

Description

The eventset_stop() function sets a flag and returns immediately. The effect of this is to instruct the worker thread to quit.

The worker thread spends most of its time inside the "main loop", which is implemented inside eventset_wait(). When eventset_wait() notices that this stop flag is set, it returns. On return from eventset_wait(), the worker thread would normally tidy up and return. Note that, because eventset_stop() returns immediately, if you want to be sure that all of those threads have actually stopped, you must wait until the worker thread has completed (for example, by calling pthread_join()).

Return value

eventset() returns NULL if successful, or non-NULL otherwise. If non-NULL, the err_t object contains error strings which may be printed or otherwise communicated to the user.

See also

eventset_wait()