O2 2.0
A communication protocol for interactive music and media applications.
o2usleep.h
1// o2usleep.h -- cross-platform definition of usleep()
2//
3// Roger B. Dannenberg
4// Oct 2020
5//
6// This file should be included first because if someone includes <unistd.h>
7// before this file sets _POSIX_C_SOURCE, then usleep() will not be defined.
8// link with o2usleep.c so that usleep() will be implemented for Windows
9
10#ifdef WIN32
11# include <windows.h>
12# define usleep(usec) Sleep((usec) / 1000)
13#else
14#if defined(__linux__) && defined(__GNUC__)
15// # define _XOPEN_SOURCE 500
16// # define _POSIX_C_SOURCE 200112L
17# include <sys/time.h>
18#endif
19#include <unistd.h>
20#endif
21