Jonas Schnelli
Jonas Schnelli

Reputation: 10005

wait / sleep until a remote file is unlocked in c

On a sftp server i create a "lockfile.lock" if another application is manipulating data. No in my c application i would like to check if the lockfile.lock exists and than "WAIT 5 SECONDS".

How do i wait 5 seconds in c without blasting the CPU to 100%?

Thanks

Upvotes: 0

Views: 244

Answers (2)

v01d
v01d

Reputation: 1507

On windows and linux there is a system call "sleep()". Windows, Linux

Upvotes: 1

Karoly Horvath
Karoly Horvath

Reputation: 96266

#include <unistd.h>
unsigned int sleep(unsigned int seconds);

DESCRIPTION
   sleep()  makes  the  calling  process  sleep  until  seconds seconds
   have elapsed or a signal arrives which is not ignored.

Upvotes: 1

Related Questions