and added files
[bcm963xx.git] / userapps / opensource / libosip2 / include / osip2 / osip_condv.h
1 /*
2   eXosip - This is the eXtended osip library.
3   Copyright (C) 2002, 2003  Aymeric MOIZARD  - jack@atosc.org
4   
5   eXosip is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9   
10   eXosip 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
13   GNU General Public License for more details.
14   
15   You should have received a copy of the GNU General Public License
16   along with this program; 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_CONDV_H__
21 #define __OSIP_CONDV_H__
22
23 #include <stdio.h>
24
25 #ifdef OSIP_MT
26
27 #ifdef ENABLE_MPATROL
28 #include <mpatrol.h>
29 #endif
30
31 /**
32  * @file osip_condv.h
33  * @brief oSIP condition variables definitions
34  *
35  * Those methods are only available if the library is compile
36  * in multi threaded mode. This is the default for oSIP.
37  */
38
39 /**
40  * @defgroup oSIP_COND oSIP condition variables definitions
41  * @ingroup oSIP
42  * @{
43  */
44
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #endif
49
50 #if defined(__PSOS__) || defined(__VXWORKS_OS__)
51
52 /* TODO */
53
54 #else
55
56
57 /* condv implementation */
58 #if defined(WIN32) || defined(_WIN32_WCE)
59 /**
60  * timespec structure
61  * @defvar struct timespec
62  */
63   struct timespec
64   {
65     long tv_sec;
66     long tv_nsec;
67   };
68 #endif
69
70   struct osip_cond;
71
72 /*
73  * Allocate and Initialise a condition variable
74  */
75   struct osip_cond *osip_cond_init (void);
76 /*
77  * Destroy a condition variable
78  * @param cond The condition variable to destroy.
79  */
80   int osip_cond_destroy (struct osip_cond *_cond);
81 /**
82  * Signal the condition variable.
83  * @param cond The condition variable to signal.
84  */
85   int osip_cond_signal (struct osip_cond *cond);
86
87 /**
88  * Wait on the condition variable.
89  * @param cond The condition variable to wait on.
90  * @param mut The external mutex 
91  */
92   int osip_cond_wait (struct osip_cond *cond, struct osip_mutex *mut);
93 /**
94  * Timed wait on the condition variable.
95  * @param cond The condition variable to wait on.
96  * @param mut The external mutex 
97  * @param abstime time to wait until
98  */
99   int osip_cond_timedwait (struct osip_cond *cond, struct osip_mutex *mut,
100                            const struct timespec *abstime);
101
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #endif
108
109 /** @} */
110
111 #endif
112
113 #endif