43 #ifndef __SBTHREAD_H__
44 #define __SBTHREAD_H__
46 #include <sphinx_config.h>
48 #include <sphinxbase/sphinxbase_export.h>
Command-line and other configurationparsing and handling.
SPHINXBASE_EXPORT int sbevent_signal(sbevent_t *evt)
Signal an event.
SPHINXBASE_EXPORT sbmsgq_t * sbthread_msgq(sbthread_t *th)
Get message queue from a thread.
SPHINXBASE_EXPORT void sbmsgq_free(sbmsgq_t *q)
Free a message queue.
SPHINXBASE_EXPORT int sbmtx_lock(sbmtx_t *mtx)
Acquire a mutex.
SPHINXBASE_EXPORT sbthread_t * sbthread_start(cmd_ln_t *config, sbthread_main func, void *arg)
Start a new thread.
SPHINXBASE_EXPORT int sbmtx_trylock(sbmtx_t *mtx)
Try to acquire a mutex.
int(* sbthread_main)(sbthread_t *th)
Entry point for a thread.
SPHINXBASE_EXPORT int sbthread_send(sbthread_t *th, size_t len, void const *data)
Send an asynchronous message to a thread.
SPHINXBASE_EXPORT sbmtx_t * sbmtx_init(void)
Create a mutex.
SPHINXBASE_EXPORT sbmsgq_t * sbmsgq_init(size_t depth)
Create a message queue.
SPHINXBASE_EXPORT cmd_ln_t * sbthread_config(sbthread_t *th)
Get configuration object from a thread.
SPHINXBASE_EXPORT void sbevent_free(sbevent_t *evt)
Free an event.
SPHINXBASE_EXPORT int sbevent_wait(sbevent_t *evt, int sec, int nsec)
Wait for an event to be signalled.
SPHINXBASE_EXPORT int sbmtx_unlock(sbmtx_t *mtx)
Release a mutex.
SPHINXBASE_EXPORT sbevent_t * sbevent_init(void)
Initialize an event.
SPHINXBASE_EXPORT int sbmsgq_send(sbmsgq_t *q, size_t len, void const *data)
Post a message to a queue.
Opaque structure used to hold the results of command-line parsing.
SPHINXBASE_EXPORT void * sbmsgq_wait(sbmsgq_t *q, size_t *out_len, int sec, int nsec)
Wait for a message from a queue.
SPHINXBASE_EXPORT void sbmtx_free(sbmtx_t *mtx)
Dispose of a mutex.
SPHINXBASE_EXPORT int sbthread_wait(sbthread_t *th)
Wait for a thread to complete.
SPHINXBASE_EXPORT void sbthread_free(sbthread_t *th)
Free a thread object.
SPHINXBASE_EXPORT void * sbthread_arg(sbthread_t *th)
Get argument pointer from a thread.