freebsd11_network: Implement pause() using snooze() instead of cvars.

This is much simpler than the prior condvar-based method and should be
functionally equivalent. It seems tsleep() cause a NULL dereference,
though (which will be fixed in the next commit), so this probably
also fixes #14355.

Change-Id: I36968de38ceb0a1c0896cae8839821f5ca383504
Reviewed-on: https://review.haiku-os.org/489
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Augustin Cavalier 2018-08-28 15:38:11 -04:00 committed by waddlesplash
parent 03e5dd5273
commit 6aed80b4f7
2 changed files with 9 additions and 9 deletions

View File

@ -36,12 +36,3 @@ wakeup(void* identifier)
{ {
publishedConditionNotifyAll(identifier); publishedConditionNotifyAll(identifier);
} }
int
_pause(const char* waitMessage, int timeout)
{
int waitChannel;
KASSERT(timeout != 0, ("pause: timeout required"));
return tsleep(&waitChannel, 0, waitMessage, timeout);
}

View File

@ -5,6 +5,15 @@
#include <compat/sys/systm.h> #include <compat/sys/systm.h>
#include <compat/sys/kernel.h>
int
_pause(const char* waitMessage, int timeout)
{
KASSERT(timeout != 0, ("pause: timeout required"));
return snooze(ticks_to_usecs(timeout));
}
void void