A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cosmetics (change 'self' identifier to 'me' for g++ compatibility)
[simgrid.git]
/
src
/
xbt
/
xbt_queue.c
diff --git
a/src/xbt/xbt_queue.c
b/src/xbt/xbt_queue.c
index
f7c70ed
..
b3829bd
100644
(file)
--- a/
src/xbt/xbt_queue.c
+++ b/
src/xbt/xbt_queue.c
@@
-1,9
+1,8
@@
-/* $Id$ */
-
/* A (synchronized) message queue. */
/* Popping an empty queue is blocking, as well as pushing a full one */
/* A (synchronized) message queue. */
/* Popping an empty queue is blocking, as well as pushing a full one */
-/* Copyright (c) 2007 Martin Quinson. All rights reserved. */
+/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+ * All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-16,7
+15,8
@@
#include "xbt/synchro.h"
#include "xbt/queue.h" /* this module */
#include "gras/virtu.h"
#include "xbt/synchro.h"
#include "xbt/queue.h" /* this module */
#include "gras/virtu.h"
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue, xbt, "Message exchanging queue");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_queue, xbt,
+ "Message exchanging queue");
typedef struct s_xbt_queue_ {
int capacity;
typedef struct s_xbt_queue_ {
int capacity;
@@
-79,7
+79,8
@@
void xbt_queue_push(xbt_queue_t queue, const void *src)
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+ DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ queue->capacity);
xbt_cond_wait(queue->not_full, queue->mutex);
}
xbt_dynar_push(queue->data, src);
xbt_cond_wait(queue->not_full, queue->mutex);
}
xbt_dynar_push(queue->data, src);
@@
-118,7
+119,8
@@
void xbt_queue_unshift(xbt_queue_t queue, const void *src)
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_acquire(queue->mutex);
while (queue->capacity != 0
&& queue->capacity == xbt_dynar_length(queue->data)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+ DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ queue->capacity);
xbt_cond_wait(queue->not_full, queue->mutex);
}
xbt_dynar_unshift(queue->data, src);
xbt_cond_wait(queue->not_full, queue->mutex);
}
xbt_dynar_unshift(queue->data, src);
@@
-165,15
+167,17
@@
void xbt_queue_push_timed(xbt_queue_t queue, const void *src, double delay)
queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_release(queue->mutex);
queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_release(queue->mutex);
- THROW2(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0",
- queue, queue->capacity);
+ THROW2(timeout_error, 0,
+ "Capacity of %p exceded (=%d), and delay = 0", queue,
+ queue->capacity);
}
} else {
while (queue->capacity != 0 &&
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
}
} else {
while (queue->capacity != 0 &&
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+ DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ queue->capacity);
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
@@
-232,7
+236,8
@@
void xbt_queue_pop_timed(xbt_queue_t queue, void *const dst, double delay)
*
* @see #xbt_queue_unshift
*/
*
* @see #xbt_queue_unshift
*/
-void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src, double delay)
+void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src,
+ double delay)
{
double begin = xbt_time();
xbt_ex_t e;
{
double begin = xbt_time();
xbt_ex_t e;
@@
-244,15
+249,17
@@
void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src, double delay)
queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_release(queue->mutex);
queue->capacity == xbt_dynar_length(queue->data)) {
xbt_mutex_release(queue->mutex);
- THROW2(timeout_error, 0, "Capacity of %p exceded (=%d), and delay = 0",
- queue, queue->capacity);
+ THROW2(timeout_error, 0,
+ "Capacity of %p exceded (=%d), and delay = 0", queue,
+ queue->capacity);
}
} else {
while (queue->capacity != 0 &&
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
}
} else {
while (queue->capacity != 0 &&
queue->capacity == xbt_dynar_length(queue->data) &&
(delay < 0 || (xbt_time() - begin) <= delay)) {
- DEBUG2("Capacity of %p exceded (=%d). Waiting", queue, queue->capacity);
+ DEBUG2("Capacity of %p exceded (=%d). Waiting", queue,
+ queue->capacity);
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
TRY {
xbt_cond_timedwait(queue->not_full, queue->mutex,
delay < 0 ? -1 : delay - (xbt_time() - begin));
@@
-275,7
+282,8
@@
void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src, double delay)
* @see #xbt_queue_shift
*
*/
* @see #xbt_queue_shift
*
*/
-void xbt_queue_shift_timed(xbt_queue_t queue, void *const dst, double delay)
+void xbt_queue_shift_timed(xbt_queue_t queue, void *const dst,
+ double delay)
{
double begin = xbt_time();
xbt_ex_t e;
{
double begin = xbt_time();
xbt_ex_t e;