kill after sleep

i couldnt make my program sleep() after using kill(pid,SIGTERM) what can i do ?

The code i'm using:

kill(PID_of_Process_to_be_killed,SIGTERM);
sleep(5); --> this is not working
sleep(5); --> this is working

the solution for now is:

kill(PID_of_Process_to_be_killed,SIGTERM);
sleep(sleep(5));

but why the first sleep after kill return 0 ?

Answers


Your sleep() call may be terminating early due to receiving a signal. Check the return value. If it's positive, you might want to sleep() again on that value. From http://www.manpagez.com/man/3/Sleep/:

If the sleep() function returns because the requested time has elapsed, the value returned will be zero. If the sleep() function returns due to the delivery of a signal, the value returned will be the unslept amount (the requested time minus the time actually slept) in seconds


Need Your Help

jQuery Mobile listview border radius and border

jquery css jquery-mobile border css3

If I set a border radius and a border for the thumbnail in a listview, it seems to treat the border as part of the picture like this:

Writing an int to a char array

c arrays pointers

I'm writing an emulator in C. Its memory is byte-addressible so I'm using a char array, but I need to read/write unaligned 32-bit integers.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.