root/src/include/ftdm_threadmutex.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* 
   2  * Cross Platform Thread/Mutex abstraction
   3  * Copyright(C) 2007 Michael Jerris
   4  *
   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
   7  * furnished to do so.
   8  *
   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. 
  17  *
  18  * Contributors: 
  19  *
  20  * Moises Silva <moy@sangoma.com>
  21  *
  22  */
  23 
  24 
  25 #ifndef _FTDM_THREADMUTEX_H
  26 #define _FTDM_THREADMUTEX_H
  27 
  28 #include "freetdm.h"
  29 
  30 #ifdef __cplusplus
  31 extern "C" {
  32 #endif
  33 
  34 typedef struct ftdm_mutex ftdm_mutex_t;
  35 typedef struct ftdm_thread ftdm_thread_t;
  36 typedef struct ftdm_interrupt ftdm_interrupt_t;
  37 typedef void *(*ftdm_thread_function_t) (ftdm_thread_t *, void *);
  38 
  39 FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached(ftdm_thread_function_t func, void *data);
  40 FT_DECLARE(ftdm_status_t) ftdm_thread_create_detached_ex(ftdm_thread_function_t func, void *data, ftdm_size_t stack_size);
  41 FT_DECLARE(void) ftdm_thread_override_default_stacksize(ftdm_size_t size);
  42 
  43 FT_DECLARE(ftdm_status_t) ftdm_mutex_create(ftdm_mutex_t **mutex);
  44 FT_DECLARE(ftdm_status_t) ftdm_mutex_destroy(ftdm_mutex_t **mutex);
  45 
  46 #define ftdm_mutex_lock(_x) _ftdm_mutex_lock(_x)
  47 FT_DECLARE(ftdm_status_t) _ftdm_mutex_lock(ftdm_mutex_t *mutex);
  48 
  49 #define ftdm_mutex_trylock(_x) _ftdm_mutex_trylock(_x)
  50 FT_DECLARE(ftdm_status_t) _ftdm_mutex_trylock(ftdm_mutex_t *mutex);
  51 
  52 #define ftdm_mutex_unlock(_x) _ftdm_mutex_unlock(_x)
  53 FT_DECLARE(ftdm_status_t) _ftdm_mutex_unlock(ftdm_mutex_t *mutex);
  54 
  55 FT_DECLARE(ftdm_status_t) ftdm_interrupt_create(ftdm_interrupt_t **cond, ftdm_socket_t device);
  56 FT_DECLARE(ftdm_status_t) ftdm_interrupt_destroy(ftdm_interrupt_t **cond);
  57 FT_DECLARE(ftdm_status_t) ftdm_interrupt_signal(ftdm_interrupt_t *cond);
  58 FT_DECLARE(ftdm_status_t) ftdm_interrupt_wait(ftdm_interrupt_t *cond, int ms);
  59 FT_DECLARE(ftdm_status_t) ftdm_interrupt_multiple_wait(ftdm_interrupt_t *interrupts[], ftdm_size_t size, int ms);
  60 
  61 #ifdef __cplusplus
  62 }
  63 #endif
  64 
  65 #endif
  66 
  67 /* For Emacs:
  68  * Local Variables:
  69  * mode:c
  70  * indent-tabs-mode:t
  71  * tab-width:4
  72  * c-basic-offset:4
  73  * End:
  74  * For VIM:
  75  * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
  76  */
  77 

/* [<][>][^][v][top][bottom][index][help] */