dude_1967
November 5th, 2002, 10:30 AM
Gurus,
I have to implement a very simple thread synchronization mechanism in Win32 as well as unix. I would like to use the Win32 API for Microsoft Windows platforms and standard Posix function calls for GCC unix platforms.
For Win32, I used a semaphore (#include <Windows.h>) created with ::CreateSemaphore(...) with an initial count of one and a maximum count of one. In combination with the standard Win32 API function ::WaitForSingleObject(...), this works well and stisfies the development goals.
Can anyone please tell me the similar, corresponding headers and functions calls for compilers such as GCC which are Posix comparible? Which headers are required? Does one have to link with libpthread or something GNU-ish which has to be installed previously?
Just a few lines of code please. The mighty GNU package CommonC++ is too big for this particular application.
Alternatively, does anyone know of a source for full Posix support for Microsoft compilers? Maybe it's there and I just don't know it.
Thanks for any help.
Chris.
:)
I have to implement a very simple thread synchronization mechanism in Win32 as well as unix. I would like to use the Win32 API for Microsoft Windows platforms and standard Posix function calls for GCC unix platforms.
For Win32, I used a semaphore (#include <Windows.h>) created with ::CreateSemaphore(...) with an initial count of one and a maximum count of one. In combination with the standard Win32 API function ::WaitForSingleObject(...), this works well and stisfies the development goals.
Can anyone please tell me the similar, corresponding headers and functions calls for compilers such as GCC which are Posix comparible? Which headers are required? Does one have to link with libpthread or something GNU-ish which has to be installed previously?
Just a few lines of code please. The mighty GNU package CommonC++ is too big for this particular application.
Alternatively, does anyone know of a source for full Posix support for Microsoft compilers? Maybe it's there and I just don't know it.
Thanks for any help.
Chris.
:)