00001 /* 00002 The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-) 00003 Copyright (C) 2001,2002,2003,2004 Aymeric MOIZARD jack@atosc.org 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef _OSIP_MT_H_ 00021 #define _OSIP_MT_H_ 00022 00023 #ifdef OSIP_MT 00024 00025 #ifdef ENABLE_MPATROL 00026 #include <mpatrol.h> 00027 #endif 00028 00029 #include <stdio.h> 00030 #include <errno.h> 00031 00046 #ifdef __cplusplus 00047 extern "C" 00048 { 00049 #endif 00050 00055 struct osip_thread; 00056 00063 struct osip_thread *osip_thread_create (int stacksize, 00064 void *(*func) (void *), void *arg); 00065 00070 int osip_thread_join (struct osip_thread *thread); 00071 00077 int osip_thread_set_priority (struct osip_thread *thread, int priority); 00081 void osip_thread_exit (void); 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif 00086 00095 #ifdef __cplusplus 00096 extern "C" 00097 { 00098 #endif 00099 00104 struct osip_sem; 00105 00110 struct osip_sem *osip_sem_init (unsigned int value); 00115 int osip_sem_destroy (struct osip_sem *sem); 00120 int osip_sem_post (struct osip_sem *sem); 00126 int osip_sem_wait (struct osip_sem *sem); 00132 int osip_sem_trywait (struct osip_sem *sem); 00133 00134 00135 #ifdef __cplusplus 00136 } 00137 #endif 00138 00147 #ifdef __cplusplus 00148 extern "C" 00149 { 00150 #endif 00151 00156 struct osip_mutex; 00157 00161 struct osip_mutex *osip_mutex_init (void); 00166 void osip_mutex_destroy (struct osip_mutex *mut); 00171 int osip_mutex_lock (struct osip_mutex *mut); 00176 int osip_mutex_unlock (struct osip_mutex *mut); 00177 00178 #ifdef __cplusplus 00179 } 00180 #endif 00181 00184 #endif /* OSIP_MT */ 00185 00186 #endif /* end of _THREAD_H_ */