TCP: Fixed RTO update and dup ACKs generation.
[haiku.git] / src / libs / compat / freebsd_network / Condvar.cpp
blob9cb5be1dcdb9a3096138504d4133dd8dd0c9ce93
1 /*
2 * Copyright 2009 Colin Günther, coling@gmx.de
3 * All Rights Reserved. Distributed under the terms of the MIT License.
4 */
7 extern "C" {
8 #include <compat/sys/condvar.h>
9 #include <compat/sys/kernel.h>
12 #include "Condvar.h"
15 void
16 conditionInit(struct cv* variable, const char* description)
18 variable->condition.Init(variable, description);
22 void
23 conditionPublish(struct cv* variable, const void* waitChannel,
24 const char* description)
26 variable->condition.Publish(waitChannel, description);
30 void
31 conditionUnpublish(struct cv* variable)
33 variable->condition.Unpublish();
37 int
38 conditionTimedWait(struct cv* variable, const int timeout)
40 status_t status = variable->condition.Wait(B_RELATIVE_TIMEOUT,
41 ticks_to_usecs(timeout));
43 if (status != B_OK)
44 status = EWOULDBLOCK;
45 return status;
49 void
50 conditionWait(struct cv* variable)
52 variable->condition.Wait();
56 void
57 conditionNotifyOne(struct cv* variable)
59 variable->condition.NotifyOne();
63 int
64 publishedConditionTimedWait(const void* waitChannel, const int timeout)
66 ConditionVariableEntry variableEntry;
68 status_t status = variableEntry.Wait(waitChannel, B_RELATIVE_TIMEOUT,
69 ticks_to_usecs(timeout));
71 if (status != B_OK)
72 status = EWOULDBLOCK;
73 return status;
77 void
78 publishedConditionNotifyAll(const void* waitChannel)
80 ConditionVariable::NotifyAll(waitChannel, B_OK);