plibsys  0.0.4
pcondvariable.h
Go to the documentation of this file.
1 /*
2  * The MIT License
3  *
4  * Copyright (C) 2010-2016 Alexander Saprykin <saprykin.spb@gmail.com>
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining
7  * a copy of this software and associated documentation files (the
8  * 'Software'), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish,
10  * distribute, sublicense, and/or sell copies of the Software, and to
11  * permit persons to whom the Software is furnished to do so, subject to
12  * the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be
15  * included in all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
68 #if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
69 # error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
70 #endif
71 
72 #ifndef PLIBSYS_HEADER_PCONDVARIABLE_H
73 #define PLIBSYS_HEADER_PCONDVARIABLE_H
74 
75 #include <pmacros.h>
76 #include <ptypes.h>
77 #include <pmutex.h>
78 
80 
82 typedef struct PCondVariable_ PCondVariable;
83 
91 
98 
109  PMutex *mutex);
110 
124 
135 
137 
138 #endif /* PLIBSYS_HEADER_PCONDVARIABLE_H */
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS...
Definition: pmacros.h:299
Miscellaneous macros.
signed int pboolean
Type for a bool.
Definition: ptypes.h:114
Mutex routines.
P_LIB_API void p_cond_variable_free(PCondVariable *cond)
Frees PCondVariable structure.
struct PCondVariable_ PCondVariable
Condition variable opaque data structure.
Definition: pcondvariable.h:82
P_LIB_API pboolean p_cond_variable_signal(PCondVariable *cond)
Emitts a signal on a given condition variable for one waiting thread.
#define P_LIB_API
Exports a symbol from a shared library.
Definition: pmacros.h:138
P_LIB_API pboolean p_cond_variable_broadcast(PCondVariable *cond)
Emitts a signal on a given condition variable for all the waiting threads.
P_LIB_API PCondVariable * p_cond_variable_new(void)
Creates a new PCondVariable.
Types definitions.
P_LIB_API pboolean p_cond_variable_wait(PCondVariable *cond, PMutex *mutex)
Waits for a signal on a given condition variable.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition: pmacros.h:298
struct PMutex_ PMutex
Mutex opaque data structure.
Definition: pmutex.h:75