aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/luaproc/channel.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/luaproc/channel.h')
-rw-r--r--libraries/luaproc/channel.h67
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
3Copyright 2008 Alexandre Skyrme, Noemi Rodriguez, Roberto Ierusalimschy
4
5Permission is hereby granted, free of charge, to any person obtaining a copy
6of this software and associated documentation files (the "Software"), to deal
7in the Software without restriction, including without limitation the rights
8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21THE 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 */
41typedef struct stchannel *channel;
42
43/* initialize channels */
44void channel_init( void );
45
46/* create new channel */
47channel channel_create( const char *cname );
48
49/* destroy a channel */
50int channel_destroy( channel chan, const char *chname );
51
52/* search for and return a channel with a given name */
53channel channel_search( const char *cname );
54
55/* return a channel's send queue */
56list channel_get_sendq( channel chan );
57
58/* return a channel's receive queue */
59list channel_get_recvq( channel chan );
60
61/* return a channel's mutex */
62pthread_mutex_t *channel_get_mutex( channel chan );
63
64/* return a channel's conditional variable */
65pthread_cond_t *channel_get_cond( channel chan );
66
67#endif