FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
thread_cond.c
Go to the documentation of this file.
1
/* condition variable functions */
2
3
#include "../fb.h"
4
#include "../fb_private_thread.h"
5
6
struct
_FBCOND
{
7
pthread_cond_t
id
;
8
};
9
10
FBCALL
FBCOND
*
fb_CondCreate
(
void
)
11
{
12
FBCOND
*
cond
;
13
14
cond = (
FBCOND
*)malloc(
sizeof
(
FBCOND
) );
15
if
( cond ) {
16
pthread_cond_init( &cond->
id
,
NULL
);
17
}
18
19
return
cond
;
20
}
21
22
FBCALL
void
fb_CondDestroy
(
FBCOND
*
cond
)
23
{
24
if
( cond ) {
25
pthread_cond_destroy( &cond->
id
);
26
free( (
void
*)cond );
27
}
28
}
29
30
FBCALL
void
fb_CondSignal
(
FBCOND
*
cond
)
31
{
32
if
( cond ) {
33
pthread_cond_signal( &cond->
id
);
34
}
35
}
36
37
FBCALL
void
fb_CondBroadcast
(
FBCOND
*
cond
)
38
{
39
if
( cond ) {
40
pthread_cond_broadcast( &cond->
id
);
41
}
42
}
43
44
FBCALL
void
fb_CondWait
(
FBCOND
*
cond
,
FBMUTEX
*
mutex
)
45
{
46
if
( cond && mutex ) {
47
pthread_cond_wait( &cond->
id
, &mutex->id );
48
}
49
}
rtlib
unix
thread_cond.c
Generated on Thu Jan 23 2014 19:40:10 for FreeBASIC by
1.8.4