tag:blogger.com,1999:blog-7585325355929395090.post2053104796784547517..comments2023-10-12T00:30:36.044-07:00Comments on Techno World: Using sleep in dev cppEnThuhttp://www.blogger.com/profile/17830174260765161858noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-7585325355929395090.post-86751783964249099212011-11-22T22:15:24.347-08:002011-11-22T22:15:24.347-08:00In header file WINDOWS.H
we have Sleep(t);
here...In header file WINDOWS.H<br /><br />we have Sleep(t); <br /><br />here t is time in milliseconds. <br /><br />You can use any one.EnThuhttps://www.blogger.com/profile/17830174260765161858noreply@blogger.comtag:blogger.com,1999:blog-7585325355929395090.post-17219348870518358592011-11-17T20:46:12.983-08:002011-11-17T20:46:12.983-08:00Ya got it.Ya got it.EnThuhttps://www.blogger.com/profile/17830174260765161858noreply@blogger.comtag:blogger.com,1999:blog-7585325355929395090.post-10244906257120904532011-11-17T09:58:48.805-08:002011-11-17T09:58:48.805-08:00This is wait and not sleep :)
wait consumes CPU c...This is wait and not sleep :)<br /><br />wait consumes CPU cycles on behalf of the calling thread (something what your while loop is doing) where as sleep suspends the execution of the calling thread.<br /><br />The unistd.h library of C has a sleep method - http://pubs.opengroup.org/onlinepubs/009604599/functions/sleep.html<br /><br />This sleep implementation delegates the responsibility to the kernel using an osapi method which then suspends the thread putting it into a sleeping state.Anonymoushttps://www.blogger.com/profile/04575941947737881981noreply@blogger.com