SIP Witch 1.9.15
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osip_mt.h
Go to the documentation of this file.
1 /*
2  The oSIP library implements the Session Initiation Protocol (SIP -rfc3261-)
3  Copyright (C) 2001-2012 Aymeric MOIZARD amoizard@antisip.com
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef _OSIP_MT_H_
21 #define _OSIP_MT_H_
22 
23 #ifndef OSIP_MONOTHREAD
24 
25 #include <stdio.h>
26 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
49  struct osip_thread;
50 
57  struct osip_thread *osip_thread_create (int stacksize, void *(*func) (void *), void *arg);
58 
63  int osip_thread_join (struct osip_thread *thread);
64 
70  int osip_thread_set_priority (struct osip_thread *thread, int priority);
74  void osip_thread_exit (void);
75 
76 #ifdef __cplusplus
77 }
78 #endif
79 
84 #ifdef __cplusplus
85 extern "C" {
86 #endif
87 
92  struct osip_sem;
93 
98  struct osip_sem *osip_sem_init (unsigned int value);
103  int osip_sem_destroy (struct osip_sem *sem);
108  int osip_sem_post (struct osip_sem *sem);
114  int osip_sem_wait (struct osip_sem *sem);
120  int osip_sem_trywait (struct osip_sem *sem);
121 
122 
123 #ifdef __cplusplus
124 }
125 #endif
126 
131 #ifdef __cplusplus
132 extern "C" {
133 #endif
134 
139  struct osip_mutex;
140 
144  struct osip_mutex *osip_mutex_init (void);
149  void osip_mutex_destroy (struct osip_mutex *mut);
154  int osip_mutex_lock (struct osip_mutex *mut);
159  int osip_mutex_unlock (struct osip_mutex *mut);
160 
161 #ifdef __cplusplus
162 }
163 #endif
164 
165 #endif /* OSIP_MONOTHREAD */
166 #endif /* end of _THREAD_H_ */
struct osip_sem * osip_sem_init(unsigned int value)
Allocate and Initialise a semaphore.
Structure for referencing a thread.
int osip_mutex_lock(struct osip_mutex *mut)
Lock the mutex.
int osip_sem_trywait(struct osip_sem *sem)
Wait operation on a semaphore.
int osip_sem_destroy(struct osip_sem *sem)
Destroy a semaphore.
int osip_thread_join(struct osip_thread *thread)
Join a thread.
void osip_mutex_destroy(struct osip_mutex *mut)
Destroy the mutex.
int osip_mutex_unlock(struct osip_mutex *mut)
Unlock the mutex.
char * value[96]
Definition: cgiserver.cpp:90
void osip_thread_exit(void)
Exit from a thread.
struct osip_mutex * osip_mutex_init(void)
Allocate and Initialise a mutex.
int osip_sem_post(struct osip_sem *sem)
Post operation on a semaphore.
int osip_thread_set_priority(struct osip_thread *thread, int priority)
Set the priority of a thread.
Structure for referencing a semaphore element.
struct osip_thread * osip_thread_create(int stacksize, void *(*func)(void *), void *arg)
Allocate (or initialise if a thread address is given)
Structure for referencing a mutex element.
int osip_sem_wait(struct osip_sem *sem)
Wait operation on a semaphore.