well i need to use a standard function for a time delay...i came across sleep() but it works n unix but m workin on windows usin dev c++...nd dev cant recogniz sleep() though i included unistd.h,dos.h, ....now i dnt want ne platform specific solution but a standard one....please help......
abt using sleep() in windows
Collapse
X
-
All unixes also have the Posix thread library (pthread) I don't know if there'sOriginally posted by BanfaThere is no standard portable sleep function, *nix has sleep Windows has Sleep.
a MS Windows implementation available (although MS Windows claims to be
Posix compliant). The pthread library offers the pthread_cond_ti medwait function
which can very well be used for an ordinary sleep() functionality.
You're not suggesting a 'busy wait' are you? -)If you want a platform portable pause you will have to write a function to do it using standard library functions such as time(...)
kind regards,
JosComment
-
There is a native Win32 pthreads implementation:Originally posted by JosAHAll unixes also have the Posix thread library (pthread) I don't know if there's
a MS Windows implementation available (although MS Windows claims to be
Posix compliant). The pthread library offers the pthread_cond_ti medwait function
which can very well be used for an ordinary sleep() functionality.
http://sourceware.org/pthreads-win32/
There are also various other cross-platform libraries that can accomplish what you're looking for. For example, wxWidgets has a function called wxMilliSleep that does what you need.
MS Windows does not exactly claim to be Posix-compliant. Windows NT was compliant with an earlier, less extensive Posix specification. I don't know if the same applies to later versions, and no version has ever claimed to be compliant with the more recent and comprehensive Posix standards.Comment
-
Ah, ok, so I guess all bets are off then when it comes to any current MS WindowsOriginally posted by nmadctThere is a native Win32 pthreads implementation:
http://sourceware.org/pthreads-win32/
There are also various other cross-platform libraries that can accomplish what you're looking for. For example, wxWidgets has a function called wxMilliSleep that does what you need.
MS Windows does not exactly claim to be Posix-compliant. Windows NT was compliant with an earlier, less extensive Posix specification. I don't know if the same applies to later versions, and no version has ever claimed to be compliant with the more recent and comprehensive Posix standards.
compliancy w.r.t. any of the latest Posix Standards?
What a mess this world is ...;-)
kind regards,
JosComment
-
UNIX-type operating systems support a lot more types of compatibility than just Posix, of course. To get an idea of the significance of this, consider that (again according the Wikipedia), while XP with MSW Services for UNIX is fully Posix-compliant, the list of those that are not officially compliant includes FreeBSD, NetBSD, OpenBSD and most Linux distros. Also, just because MS supports Posix interfaces doesn't mean it has quality implementations .Comment
Comment