mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-22 05:34:12 -04:00
tests: add test_usleep and test_sleep functions
The former one was already used in tests, but was private. These functions can be shared across the tests, so make them public. Signed-off-by: Marek Chalupa <mchqwerty@gmail.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
7bf8049c48
commit
6ebe55060e
3 changed files with 44 additions and 15 deletions
|
|
@ -333,21 +333,6 @@ register_reading(struct wl_display *display)
|
|||
assert(wl_display_flush(display) >= 0);
|
||||
}
|
||||
|
||||
#define USEC_TO_NSEC(n) (1000 * (n))
|
||||
|
||||
/* since we are using alarm() and SIGABRT, we can not
|
||||
* use usleep function (see 'man usleep') */
|
||||
static void
|
||||
test_usleep(useconds_t usec)
|
||||
{
|
||||
struct timespec ts = {
|
||||
.tv_sec = 0,
|
||||
.tv_nsec = USEC_TO_NSEC(usec)
|
||||
};
|
||||
|
||||
assert(nanosleep(&ts, NULL) == 0);
|
||||
}
|
||||
|
||||
/* create thread that will call prepare+read so that
|
||||
* it will block */
|
||||
static pthread_t
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue