You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
537 B

--- a/examples/nonblocking.c
+++ b/examples/nonblocking.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
#include <unistd.h>
#include <shout/shout.h>
@@ -70,8 +71,10 @@ int main()
if (ret == SHOUTERR_BUSY)
printf("Connection pending...\n");
+ const struct timespec req = {0, 10 * 1000 * 1000};
+ struct timespec rem;
while (ret == SHOUTERR_BUSY) {
- usleep(10000);
+ nanosleep(&req, &rem);
ret = shout_get_connected(shout);
}