2 The oSIP library implements the Session Initiation Protocol (SIP -rfc2543-)
3 Copyright (C) 2001 Aymeric MOIZARD jack@atosc.org
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.
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.
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
34 * @brief oSIP Thread, Mutex and Semaphore definitions
36 * Those methods are only available if the library is compile
37 * in multi threaded mode. This is the default for oSIP.
41 * @defgroup oSIP_THREAD oSIP Thread Routines
52 * Structure for referencing a thread
58 * Allocate (or initialise if a thread address is given)
59 * @param stacksize The stack size of the thread. (20000 is a good value)
60 * @param func The method where the thread start.
61 * @param arg A pointer on the argument given to the method 'func'.
63 struct osip_thread *osip_thread_create (int stacksize,
64 void *(*func) (void *), void *arg);
68 * @param thread The thread to join.
70 int osip_thread_join (struct osip_thread *thread);
73 * Set the priority of a thread. (NOT IMPLEMENTED ON ALL SYSTEMS)
74 * @param thread The thread to work on.
75 * @param priority The priority value to set.
77 int osip_thread_set_priority (struct osip_thread *thread, int priority);
81 void osip_thread_exit (void);
90 * @defgroup oSIP_SEMA oSIP semaphore definitions
101 * Structure for referencing a semaphore element.
102 * @defvar struct osip_sem
107 * Allocate and Initialise a semaphore.
108 * @param value The initial value for the semaphore.
110 struct osip_sem *osip_sem_init (unsigned int value);
112 * Destroy a semaphore.
113 * @param sem The semaphore to destroy.
115 int osip_sem_destroy (struct osip_sem *sem);
117 * Post operation on a semaphore.
118 * @param sem The semaphore to destroy.
120 int osip_sem_post (struct osip_sem *sem);
122 * Wait operation on a semaphore.
123 * NOTE: this call will block if the semaphore is at 0.
124 * @param sem The semaphore to destroy.
126 int osip_sem_wait (struct osip_sem *sem);
128 * Wait operation on a semaphore.
129 * NOTE: if the semaphore is at 0, this call won't block.
130 * @param sem The semaphore to destroy.
132 int osip_sem_trywait (struct osip_sem *sem);
142 * @defgroup oSIP_MUTEX oSIP semaphore definitions
153 * Structure for referencing a semaphore element.
154 * @defvar struct osip_mutex
159 * Allocate and Initialise a semaphore.
161 struct osip_mutex *osip_mutex_init (void);
164 * @param mut The mutex to destroy.
166 void osip_mutex_destroy (struct osip_mutex *mut);
169 * @param mut The mutex to lock.
171 int osip_mutex_lock (struct osip_mutex *mut);
174 * @param mut The mutex to unlock.
176 int osip_mutex_unlock (struct osip_mutex *mut);
186 #endif /* end of _THREAD_H_ */