Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Got bored during a meeting: fix the copyright notice of several useless files (found...
[simgrid.git] / include / xbt / queue.h
1 /* $Id$ */
2
3 /* A (synchronized) message queue.                                          */
4 /* Popping an empty queue is blocking, as well as pushing a full one        */
5
6 /* Copyright (c) 2007 Martin Quinson. All rights reserved.                  */
7
8 /* This program is free software; you can redistribute it and/or modify it
9  * under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #ifndef _XBT_QUEUE_H
12 #define _XBT_QUEUE_H
13
14 #include "xbt/misc.h" /* SG_BEGIN_DECL */
15 //#include "xbt/function_types.h"
16
17 SG_BEGIN_DECL()
18
19 /** @addtogroup XBT_queue
20   * @brief Synchronized message exchanging queue.
21   *
22   * These is the classical producer/consumer synchronization scheme, which all concurrent programmer recode one day or another.
23   *  
24   * For performance concerns, the content of queue must be homogeneous, 
25   * just like dynars (see the \ref XBT_dynar section). Indeed, queues use a 
26   * dynar to store the data, and add the synchronization on top of it. 
27   * 
28   * @{
29   */
30
31   /** \brief Queue data type (opaque type) */
32   typedef struct s_xbt_queue_ *xbt_queue_t;
33
34
35   XBT_PUBLIC(xbt_queue_t)   xbt_queue_new(int capacity, unsigned long elm_size);
36   XBT_PUBLIC(void)          xbt_queue_free(xbt_queue_t *queue);
37
38   XBT_PUBLIC(unsigned long) xbt_queue_length(const xbt_queue_t queue);
39
40   XBT_PUBLIC(void) xbt_queue_push     (xbt_queue_t queue, const void *src);
41   XBT_PUBLIC(void) xbt_queue_pop      (xbt_queue_t queue, void *const dst);
42   XBT_PUBLIC(void) xbt_queue_unshift (xbt_queue_t queue, const void *src);
43   XBT_PUBLIC(void) xbt_queue_shift   (xbt_queue_t queue, void *const dst);
44
45   XBT_PUBLIC(void) xbt_queue_push_timed    (xbt_queue_t queue, const void *src, double delay);
46   XBT_PUBLIC(void) xbt_queue_unshift_timed (xbt_queue_t queue, const void *src, double delay);
47   XBT_PUBLIC(void) xbt_queue_shift_timed   (xbt_queue_t queue, void *const dst, double delay);
48   XBT_PUBLIC(void) xbt_queue_pop_timed     (xbt_queue_t queue, void *const dst, double delay);
49
50 /** @} */
51
52 SG_END_DECL()
53
54 #endif /* _XBT_QUEUE_H */