1    | #ifndef READ_THREAD
2    | #define READ_THREAD
3    | 
4    | /***************************************
5    |   $Revision: 1.17 $
6    | 
7    |   Thread module (th)
8    | 
9    |   Status: NOT REVUED, NOT TESTED
10   | 
11   |   ******************/ /******************
12   |   Copyright (c) 1999                              RIPE NCC
13   |  
14   |   All Rights Reserved
15   |   
16   |   Permission to use, copy, modify, and distribute this software and its
17   |   documentation for any purpose and without fee is hereby granted,
18   |   provided that the above copyright notice appear in all copies and that
19   |   both that copyright notice and this permission notice appear in
20   |   supporting documentation, and that the name of the author not be
21   |   used in advertising or publicity pertaining to distribution of the
22   |   software without specific, written prior permission.
23   |   
24   |   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
25   |   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
26   |   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
27   |   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
28   |   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
29   |   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
30   |   ***************************************/
31   | #include <pthread.h>       /* Posix thread library */
32   | /*
33   | typedef struct _rwlock {
34   |   pthread_mutex_t rw_mutex;
35   |   pthread_cond_t rw_cond;
36   |   int rw_count;
37   | } rw_lock_t;
38   | */
39   | /* structure for writers favouring functions */
40   | typedef struct _rwlock {
41   |   pthread_mutex_t rw_mutex;
42   |   pthread_cond_t rw_cond;
43   |   pthread_cond_t w_cond;
44   |   int rw_count;
45   |   int w_count;
46   | } rw_lock_t;
47   | 
48   | /*
49   | typedef struct _wd_args_t {
50   |   int connected_socket;
51   |   pthread_t tid;
52   | } wd_args_t;  
53   | */
54   | /* Readers writers lock functions favoring readers */
55   | void TH_acquire_read_lock(rw_lock_t *prw_lock);
56   | void TH_release_read_lock(rw_lock_t *prw_lock);
57   | void TH_acquire_write_lock(rw_lock_t *prw_lock);
58   | void TH_release_write_lock(rw_lock_t *prw_lock);
59   | void TH_init_read_write_lock(rw_lock_t *prw_lock);
60   | 
61   | /* Readers writers lock functions favoring writers */
62   | void TH_acquire_read_lockw(rw_lock_t *prw_lock);
63   | void TH_release_read_lockw(rw_lock_t *prw_lock);
64   | void TH_acquire_write_lockw(rw_lock_t *prw_lock);
65   | void TH_release_write_lockw(rw_lock_t *prw_lock);
66   | void TH_init_read_write_lockw(rw_lock_t *prw_lock);
67   | 
68   | int TH_get_id(void);
69   | char *TH_to_string(void);
70   | pthread_t TH_create(void *do_function(void *), void *arguments );
71   | 
72   | /* 	
73   | void TH_hdl_signal(void);
74   | void TH_watchdog(wd_args_t *wd_args);
75   | void TH_run(int sock, void *do_function(void *));
76   | void TH_run1(int sock, void *do_function(void *));
77   | void TH_run2(void *function(void *));
78   | */ 
79   | #endif /* READ_THREAD */