FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
unix_shared_memory_queue.h
Go to the documentation of this file.
1 /*
2  *------------------------------------------------------------------
3  * unix_shared_memory_queue.h - shared-memory queues
4  *
5  * Copyright (c) 2009 Cisco and/or its affiliates.
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at:
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *------------------------------------------------------------------
18  */
19 
20 #ifndef included_unix_shared_memory_queue_h
21 #define included_unix_shared_memory_queue_h
22 
23 #include <pthread.h>
24 
25 typedef struct _unix_shared_memory_queue
26 {
27  pthread_mutex_t mutex; /* 8 bytes */
28  pthread_cond_t condvar; /* 8 bytes */
29  int head;
30  int tail;
31  volatile int cursize;
32  int maxsize;
33  int elsize;
34  int consumer_pid;
35  int signal_when_queue_non_empty;
36  char data[0];
38 
40  int elsize,
41  int consumer_pid,
42  int
43  signal_when_queue_non_empty);
46  int nowait);
48  u8 * elem2, int nowait);
50  int nowait);
55  u8 * elem);
56 
58  u8 * elem);
60  u8 * elem);
61 
62 #endif /* included_unix_shared_memory_queue_h */
63 
64 /*
65  * fd.io coding-style-patch-verification: ON
66  *
67  * Local Variables:
68  * eval: (c-set-style "gnu")
69  * End:
70  */
int unix_shared_memory_queue_add2(unix_shared_memory_queue_t *q, u8 *elem, u8 *elem2, int nowait)
int unix_shared_memory_queue_sub(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
int unix_shared_memory_queue_add(unix_shared_memory_queue_t *q, u8 *elem, int nowait)
int unix_shared_memory_queue_add_raw(unix_shared_memory_queue_t *q, u8 *elem)
void unix_shared_memory_queue_lock(unix_shared_memory_queue_t *q)
int unix_shared_memory_queue_sub_raw(unix_shared_memory_queue_t *q, u8 *elem)
unix_shared_memory_queue_t * unix_shared_memory_queue_init(int nels, int elsize, int consumer_pid, int signal_when_queue_non_empty)
int unix_shared_memory_queue_add_nolock(unix_shared_memory_queue_t *q, u8 *elem)
void unix_shared_memory_queue_unlock(unix_shared_memory_queue_t *q)
unsigned char u8
Definition: types.h:56
int unix_shared_memory_queue_is_full(unix_shared_memory_queue_t *q)
struct _unix_shared_memory_queue unix_shared_memory_queue_t
void unix_shared_memory_queue_free(unix_shared_memory_queue_t *q)