8.2. Threading API
If Anjay is compiled with thread safety enabled (
option), it requires some basic threading primitives to be implemented for the
thread safety features to work properly.
The same threading primitives are additionally used by the
avs_log modules regardless of whether thread safety is enabled or not.
The specific requirements are:
avs_logand Anjay thread safety require
avs_sched optionally depends on
avs_condvar_notify_all() as well as
avs_mutex_* APIs. The dependency can be controlled with
WITH_SCHEDULER_THREAD_SAFE CMake option. This option normally has the same
There are two independent implementations of the threading API for compatibility with most platforms:
You may use either of the implementations listed above as a reference for writing your own if necessary.
8.2.2. List of functions to implement
If, for some reason neither of the default implementations is suitable:
WITH_CUSTOM_AVS_THREADING=ONwhen running CMake on Anjay,
Provide an implementation of:
And if you use thread-safe scheduler, also provide implementation for:
For signatures and detailed description of listed functions, see
If you intend to operate the library in a single-threaded fashion, you may provide no-op stubs (returning success) of all mentioned primitives.