+
+
+
+
+/** @brief Push something to the message exchange queue, with a timeout.
+ *
+ * @seealso #xbt_queue_push
+ */
+void xbt_queue_push_timed(xbt_queue_t queue, const void *src,double delay) {
+ xbt_mutex_lock(queue->mutex);
+ while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
+ DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
+ xbt_cond_timedwait(queue->not_full,queue->mutex, delay);
+ }
+ xbt_dynar_push(queue->data,src);
+ xbt_cond_signal(queue->not_empty);
+}
+
+
+/** @brief Pop something from the message exchange queue, with a timeout.
+ *
+ * @seealso #xbt_queue_pop
+ *
+ */
+void xbt_queue_pop_timed(xbt_queue_t queue, void* const dst,double delay) {
+ xbt_mutex_lock(queue->mutex);
+ while (xbt_dynar_length(queue->data) == 0) {
+ DEBUG1("Queue %p empty. Waiting",queue);
+ xbt_cond_timedwait(queue->not_empty,queue->mutex,delay);
+ }
+ xbt_dynar_pop(queue->data,dst);
+ xbt_cond_signal(queue->not_full);
+}
+
+/** @brief Unshift something to the message exchange queue, with a timeout.
+ *
+ * @seealso #xbt_queue_unshift
+ */
+void xbt_queue_unshift_timed(xbt_queue_t queue, const void *src,double delay) {
+ xbt_mutex_lock(queue->mutex);
+ while (queue->capacity != 0 && queue->capacity == xbt_dynar_length(queue->data)) {
+ DEBUG2("Capacity of %p exceded (=%d). Waiting",queue,queue->capacity);
+ xbt_cond_timedwait(queue->not_full,queue->mutex,delay);
+ }
+ xbt_dynar_unshift(queue->data,src);
+ xbt_cond_signal(queue->not_empty);
+}
+
+
+/** @brief Shift something from the message exchange queue, with a timeout.
+ *
+ * @seealso #xbt_queue_shift
+ *
+ */
+void xbt_queue_shift_timed(xbt_queue_t queue, void* const dst,double delay) {
+ xbt_mutex_lock(queue->mutex);
+ while (xbt_dynar_length(queue->data) == 0) {
+ DEBUG1("Queue %p empty. Waiting",queue);
+ xbt_cond_timedwait(queue->not_empty,queue->mutex,delay);
+ }
+ xbt_dynar_shift(queue->data,dst);
+ xbt_cond_signal(queue->not_full);
+}