-
Notifications
You must be signed in to change notification settings - Fork 1
/
tube.h
56 lines (43 loc) · 1.46 KB
/
tube.h
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
/* tube.h - tubes header */
/* Copyright (C) 2008 Keith Rarick and Philotic Inc.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef tube_h
#define tube_h
typedef struct tube *tube;
typedef void(*evh)(int, short, void *);
#include "stat.h"
#include "job.h"
#include "pq.h"
#include "ms.h"
#define MAX_TUBE_NAME_LEN 201
struct tube {
unsigned int refs;
char name[MAX_TUBE_NAME_LEN];
struct pq ready;
struct pq delay;
struct job buried;
struct ms waiting; /* set of conns */
struct stats stat;
unsigned int using_ct;
unsigned int watching_ct;
usec pause;
usec deadline_at;
};
extern struct ms tubes;
tube make_tube(const char *name);
void tube_dref(tube t);
void tube_iref(tube t);
tube tube_find(const char *name);
tube tube_find_or_make(const char *name);
#define TUBE_ASSIGN(a,b) (tube_dref(a), (a) = (b), tube_iref(a))
#endif /*tube_h*/