On Wed, Sep 15, 2010 at 6:10 AM, Ruben Van Boxem
<[email protected]> wrote:
> 2010/8/31 GhostlyDeath <[email protected]>
>>
>> Win32 has conditions, however it's Vista/2008 and on:
>>
>> http://msdn.microsoft.com/en-us/library/ms682052(VS.85).aspx
>>
>> So it won't be available on lower end systems. Thread conditions are
>> basically "wait until this thing happens" which is essentially the
>> same thing as a mutex, kinda.
>>
>> #include <windows.h>
>>
>> volatile int did_something_happen =3D 0;
>>
>> DWORD x(void* arg)
>> {
>>    while (!did_something_happen)
>>         Sleep(0);
>>    printf("Happened\n");
>>    return 0;
>> }
>>
>> int main(int argc, char** argv)
>> {
>>    CreateThread(NULL, 0, x, NULL, 0);
>>
>>     Sleep(5000);
>>
>>     did_something_happen =3D 1;
>>
>>     Sleep(1000);
>>
>>     return 1;
>> }
>>
>> I'd say the best way to do it with Win32 would be if you can add a
>> non-visible static variable which contains the
>> LoadLibrary("kernel32.dll") and then a call to get the thread
>> condition function in that DLL, if it's non-null then use the Win32
>> stuff, if it is NULL, then make your own thread condition. If you want
>> threads to wake up from a call, the function setting the condition
>> stuff (called from the calling thread) can add stuff to some structure
>> of which condition to wake up on, then use the proper Win32
>> ResumeThread/SuspendThread. If the suspended thread happens to wakeup,
>> recheck the condition to see if it really happened and resume if it
>> did.
>>
>
> I'd say that's mightily helpful, but I don't know mingw-w64's project stance
> on Windows XP compatibility. Truth is though, for x64 at least, XP was never
> really adopted and true x64 Windows only happened in Vista/2008/7. Is there
> a way to have an option is GCC to compile it with Vista+ threading, and if
> so, use this new API, which will tremendously ease the effort of getting the
> gthread stuff in place?
>
> Ruben
>

You can put in a feature request on our FR tracker, though I'm not
sure if there's anybody both willing and able to do it.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to