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

  1. --- a/examples/nonblocking.c
  2. +++ b/examples/nonblocking.c
  3. @@ -6,6 +6,7 @@
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <string.h>
  7. +#include <time.h>
  8. #include <unistd.h>
  9. #include <shout/shout.h>
  10. @@ -70,8 +71,10 @@ int main()
  11. if (ret == SHOUTERR_BUSY)
  12. printf("Connection pending...\n");
  13. + const struct timespec req = {0, 10 * 1000 * 1000};
  14. + struct timespec rem;
  15. while (ret == SHOUTERR_BUSY) {
  16. - usleep(10000);
  17. + nanosleep(&req, &rem);
  18. ret = shout_get_connected(shout);
  19. }