diff options
Diffstat (limited to 'libraries/luaproc/channel.h')
-rw-r--r-- | libraries/luaproc/channel.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/libraries/luaproc/channel.h b/libraries/luaproc/channel.h new file mode 100644 index 0000000..1cced9e --- /dev/null +++ b/libraries/luaproc/channel.h | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************** | ||
2 | |||
3 | Copyright 2008 Alexandre Skyrme, Noemi Rodriguez, Roberto Ierusalimschy | ||
4 | |||
5 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
6 | of this software and associated documentation files (the "Software"), to deal | ||
7 | in the Software without restriction, including without limitation the rights | ||
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
9 | copies of the Software, and to permit persons to whom the Software is | ||
10 | furnished to do so, subject to the following conditions: | ||
11 | |||
12 | The above copyright notice and this permission notice shall be included in | ||
13 | all copies or substantial portions of the Software. | ||
14 | |||
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
21 | THE SOFTWARE. | ||
22 | |||
23 | ***************************************************** | ||
24 | |||
25 | [channel.h] | ||
26 | |||
27 | ****************************************************/ | ||
28 | |||
29 | #ifndef _CHANNEL_H_ | ||
30 | #define _CHANNEL_H_ | ||
31 | |||
32 | #include <pthread.h> | ||
33 | |||
34 | #include "list.h" | ||
35 | |||
36 | #define CHANNEL_MAX_NAME_LENGTH 255 | ||
37 | |||
38 | #define CHANNEL_DESTROYED 0 | ||
39 | |||
40 | /* message channel pointer type */ | ||
41 | typedef struct stchannel *channel; | ||
42 | |||
43 | /* initialize channels */ | ||
44 | void channel_init( void ); | ||
45 | |||
46 | /* create new channel */ | ||
47 | channel channel_create( const char *cname ); | ||
48 | |||
49 | /* destroy a channel */ | ||
50 | int channel_destroy( channel chan, const char *chname ); | ||
51 | |||
52 | /* search for and return a channel with a given name */ | ||
53 | channel channel_search( const char *cname ); | ||
54 | |||
55 | /* return a channel's send queue */ | ||
56 | list channel_get_sendq( channel chan ); | ||
57 | |||
58 | /* return a channel's receive queue */ | ||
59 | list channel_get_recvq( channel chan ); | ||
60 | |||
61 | /* return a channel's mutex */ | ||
62 | pthread_mutex_t *channel_get_mutex( channel chan ); | ||
63 | |||
64 | /* return a channel's conditional variable */ | ||
65 | pthread_cond_t *channel_get_cond( channel chan ); | ||
66 | |||
67 | #endif | ||