Skip to content

Commit

Permalink
tests/optional_mutex: use millisleep.h
Browse files Browse the repository at this point in the history
This should have been done shortly after:
    2024-01-01 Import millisleep.h
    bfffdd7
  • Loading branch information
gperciva committed Jun 27, 2024
1 parent 37f9834 commit 1604ca8
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions tests/optional_mutex/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdlib.h>
#include <string.h>

#include "millisleep.h"
#include "optional_mutex.h"
#include "warnp.h"

Expand All @@ -12,17 +13,6 @@ static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
static int value = 0;
static int counter = 0;

/* Wait duration can be interrupted by signals. */
static inline void
millisleep(size_t msec)
{
struct timespec ts;

ts.tv_sec = msec / 1000;
ts.tv_nsec = (msec % 1000) * 1000000;
nanosleep(&ts, NULL);
}

static void *
inc_dec_counter(void * cookie)
{
Expand Down

0 comments on commit 1604ca8

Please sign in to comment.