2 * Cross Platform Thread/Mutex abstraction
3 * Copyright(C) 2007 Michael Jerris
5 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
6 * copies of the Software, and permit persons to whom the Software is
9 * This work is provided under this license on an "as is" basis, without warranty of any kind,
10 * either expressed or implied, including, without limitation, warranties that the covered code
11 * is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire
12 * risk as to the quality and performance of the covered code is with you. Should any covered
13 * code prove defective in any respect, you (not the initial developer or any other contributor)
14 * assume the cost of any necessary servicing, repair or correction. This disclaimer of warranty
15 * constitutes an essential part of this license. No use of any covered code is authorized hereunder
16 * except under this disclaimer.
21 #ifndef _ESL_THREADMUTEX_H
22 #define _ESL_THREADMUTEX_H
28 #endif /* defined(__cplusplus) */
30 typedef struct esl_mutex esl_mutex_t;
31 typedef struct esl_thread esl_thread_t;
32 typedef void *(*esl_thread_function_t) (esl_thread_t *, void *);
34 ESL_DECLARE(esl_status_t) esl_thread_create_detached(esl_thread_function_t func, void *data);
35 esl_status_t esl_thread_create_detached_ex(esl_thread_function_t func, void *data, size_t stack_size);
36 void esl_thread_override_default_stacksize(size_t size);
37 ESL_DECLARE(esl_status_t) esl_mutex_create(esl_mutex_t **mutex);
38 ESL_DECLARE(esl_status_t) esl_mutex_destroy(esl_mutex_t **mutex);
39 ESL_DECLARE(esl_status_t) esl_mutex_lock(esl_mutex_t *mutex);
40 ESL_DECLARE(esl_status_t) esl_mutex_trylock(esl_mutex_t *mutex);
41 ESL_DECLARE(esl_status_t) esl_mutex_unlock(esl_mutex_t *mutex);
45 #endif /* defined(__cplusplus) */
47 #endif /* defined(_ESL_THREADMUTEX_H) */
57 * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab: