Commit 0672d883 authored by rna's avatar rna

Use timedwait for space.

parent 3ea610e2
Pipeline #2515 failed with stages
in 1 minute and 11 seconds
......@@ -3,6 +3,7 @@
#include "xlap.h"
#include "../util/common.h"
#include "../util/dbg.h"
#include "../util/time.h"
#include "stores/inFlightPacketStore.h"
#include "receiver.h"
......@@ -297,7 +298,8 @@ prrtByteCount_t PrrtReceiver_get_space(PrrtReceiver *receiver) {
void PrrtReceiver_wait_for_space(PrrtReceiver *receiver) {
check(pthread_mutex_lock(&receiver->lock) == 0, "Lock failed.");
pthread_cond_wait(&receiver->wait_for_space, &receiver->lock);
struct timespec deadline = abstime_from_now(BBR_getRTProp(receiver->bbr));
pthread_cond_timedwait(&receiver->wait_for_space, &receiver->lock, &deadline);
check(pthread_mutex_unlock(&receiver->lock) == 0, "Unlock failed.");
return;
......@@ -342,7 +344,6 @@ void PrrtReceiver_add_outstanding_packet_state(PrrtReceiver *recv, PrrtPacket *p
pthread_cond_broadcast(&recv->wait_for_space);
check(pthread_mutex_unlock(&recv->lock) == 0, "Unlock failed.");
return;
error:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment