Why are nanosleep() and usleep() too slow?

Posted by user351990 on Stack Overflow See other posts from Stack Overflow or by user351990
Published on 2010-05-27T13:13:25Z Indexed on 2010/05/27 14:11 UTC
Read the original article Hit count: 245

Filed under:

I have a program that generates packets to send to a receiver. I need an efficient method of introducing a small delay between the sending of each packet so as not to overrun the receiver. I've tried usleep() and nanosleep() but they seem to be too slow. I've implemented a busy wait loop and had more success, but it's not the most efficient method, I know. I'm interested in anyone's experiences in trying to do what I'm doing. Do others find usleep() and nanosleep() to function well for this type of application?

Thanks,

Danny Llewallyn

© Stack Overflow or respective owner

Related posts about c