catimg icon indicating copy to clipboard operation
catimg copied to clipboard

Potentially used usleep()

Open RootUp opened this issue 7 years ago • 1 comments

File: catimg/blob/master/src/catimg.c#L138

i.e usleep(img.delays[frame - 1] * 10000);

The usleep() function suspends execution of the calling thread for (at least) usec microseconds. The parameter you pass is a minimum time for sleeping. There's no guarantee that the thread will wake up after exactly the time specified. Given the specific dynamics of the scheduler, it may result in longer than expected delays.

Use nanosleep() instead.

Cheers!

RootUp avatar Jul 10 '18 08:07 RootUp

A pr and making sure it works with gifs would be nice 🙂

posva avatar Jul 10 '18 08:07 posva