stream_pool.h
2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef SCOT_STREAM_POOL_H
#define SCOT_STREAM_POOL_H
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <scot/event_listener.h>
#include <scot/stream.h>
#include <scot/thread.h>
#include <scot/stream_pool_fraction.h>
#define GEN_LOCAL
# include <scot/list.h>
#undef GEN_LOCAL
/*
* folgende masken dienen dazu zu bestimmen in welches fd_set
* (read, write, exception) ein filehandle eingetragen werden soll.
* D.h. für welche operation der select diesen handle überwachen soll.
*/
#define SCOT_STREAM_POOL_FD_ADD_RMASK 0x1
#define SCOT_STREAM_POOL_FD_ADD_WMASK 0x2
#define SCOT_STREAM_POOL_FD_ADD_EMASK 0x4
#define SCOT_STREAM_POOL_CLEANUP 0x00
#define SCOT_STREAM_POOL_RESTART_FRACTION 0x01
#define SCOT_STREAM_POOL_START_FRACTION 0x02
#define SCOT_STREAM_POOL_STOP_FRACTION 0x03
#define SCOT_STREAM_POOL_RESTART_ALL_FRAC 0x04
#define SCOT_STREAM_POOL_START_ALL_FRAC 0x05
#define SCOT_STREAM_POOL_STOP_ALL_FRAC 0x06
#define SCOT_STREAM_POOL_KEEP_STREAMS 0x0
#define SCOT_STREAM_POOL_FREE_STREAMS 0x1
typedef struct scot_sp_fraction scot_sp_fraction;
GEN_LIST_TYPE_PROTO (scot_sp_fraction);
struct scot_stream_pool
{
struct scot_event_listener el;
uint16_t cmd;
void * cmd_arg;
THREAD_COND_T cmd_cond;
THREAD_COND_CS_T cmd_cs;
list_scot_sp_fraction_node_t * pool;
THREAD_MUTEX_T mutex;
};
struct scot_stream_pool * scot_stream_pool_new (struct scot_stream_pool *);
void scot_stream_pool_free (struct scot_stream_pool *);
void scot_stream_pool_free_s (struct scot_stream_pool *,
int);
void scot_stream_pool_add (struct scot_stream_pool *,
struct scot_stream *,
int);
void scot_stream_pool_remove (struct scot_stream_pool *,
struct scot_stream *,
int);
int scot_stream_pool_get_rwe (struct scot_stream_pool *,
struct scot_stream *);
void scot_stream_pool_cmd (struct scot_stream_pool *,
uint16_t,
void *);
struct scot_stream * scot_sp_get_all_streams (struct scot_stream_pool *);
#endif /* SCOT_STREAM_POOL_H */