CUBRID Engine  latest
shard_proxy_queue.h
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Search Solution Corporation
3  * Copyright 2016 CUBRID Corporation
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 
20 /*
21  * shard_proxy_queue.h -
22  *
23  */
24 
25 #ifndef _SHARD_PROXY_QUEUE_H_
26 #define _SHARD_PROXY_QUEUE_H_
27 
28 #ident "$Id$"
29 
30 #if !defined(WINDOWS)
31 #include <pthread.h>
32 #endif /* !WINDOWS */
33 
34 typedef int (*SHARD_COMP_FN) (const void *arg1, const void *arg2);
35 
38 {
40 
41  void *v;
42 };
43 
46 {
47  pthread_mutex_t lock; /* further use */
48  pthread_cond_t cond; /* further use */
49 
52 };
53 
56 {
57  int size;
58  int count;
59  int front;
60  int rear;
61 
62  void **ent;
63 };
64 
65 extern int shard_queue_enqueue (T_SHARD_QUEUE * q, void *v);
66 extern int shard_queue_ordered_enqueue (T_SHARD_QUEUE * q, void *v, SHARD_COMP_FN comp_fn);
67 extern void *shard_queue_dequeue (T_SHARD_QUEUE * q);
68 extern void *shard_queue_peek_value (T_SHARD_QUEUE * q);
69 #if 0 /* not implemented yet */
70 extern void *shard_queue_dequeue_nonblocking (T_SHARD_QUEUE * q);
71 extern void *shard_queue_dequeue_blocking (T_SHARD_QUEUE * q);
72 #endif
73 extern int shard_queue_initialize (T_SHARD_QUEUE * q);
74 extern void shard_queue_destroy (T_SHARD_QUEUE * q);
75 
76 extern int shard_cqueue_enqueue (T_SHARD_CQUEUE * cq, void *e);
77 extern void *shard_cqueue_dequeue (T_SHARD_CQUEUE * cq);
78 
79 extern int shard_cqueue_initialize (T_SHARD_CQUEUE * cq, int size);
80 extern void shard_cqueue_destroy (T_SHARD_CQUEUE * cq);
81 
82 #endif /* _SHARD_PROXY_QUEUE_H_ */
int shard_queue_initialize(T_SHARD_QUEUE *q)
int shard_queue_ordered_enqueue(T_SHARD_QUEUE *q, void *v, SHARD_COMP_FN comp_fn)
void * shard_queue_dequeue(T_SHARD_QUEUE *q)
T_SHARD_QUEUE_ENT * tail
int(* SHARD_COMP_FN)(const void *arg1, const void *arg2)
int shard_queue_enqueue(T_SHARD_QUEUE *q, void *v)
void shard_queue_destroy(T_SHARD_QUEUE *q)
T_SHARD_QUEUE_ENT * head
void * shard_queue_peek_value(T_SHARD_QUEUE *q)
int shard_cqueue_initialize(T_SHARD_CQUEUE *cq, int size)
void * shard_cqueue_dequeue(T_SHARD_CQUEUE *cq)
int shard_cqueue_enqueue(T_SHARD_CQUEUE *cq, void *e)
pthread_cond_t cond
void shard_cqueue_destroy(T_SHARD_CQUEUE *cq)
T_SHARD_QUEUE_ENT * next
pthread_mutex_t lock