Archived
1
0
Fork 0

fix a 100% cpu usage mistake

This commit is contained in:
michael bishop 2015-07-25 17:07:21 -03:00
parent f1778e3f70
commit 44de099d9d

7
main.c
View file

@ -3,6 +3,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#define IP_LENGTH_MAX 15
@ -116,7 +117,11 @@ int main()
// Event loop
while (tox_iteration_interval(tox)) {
struct timespec delay;
while (true) {
delay.tv_sec = 0;
delay.tv_nsec = tox_iteration_interval(tox) * 1000000;
nanosleep(&delay,NULL);
tox_iterate(tox);
}