2012/5/9 K. Frank <[email protected]>:
> Hi Gaby!
>
> On Wed, May 9, 2012 at 3:08 PM, Gabriel Dos Reis
> <[email protected]> wrote:
>> On Wed, May 9, 2012 at 2:06 PM, K. Frank <[email protected]> wrote:
>>
>>> However, as noted in my previous post, I have happily done some
>>> (limited) windows-api threading programming with Ruben's build
>>> (and also did the windows-api threading programming necessary
>>> to implement <thread>), all, I guess, with a gcc build built using
>>> --enable-threads=posix, so what then does --enable-threads=win32
>>> actually do?
>>
>> See TDM's build (which is --enable-threads=win32)
>
> I've used a couple of TDM's builds in the past (but I'm not sure I
> ever used it with threading, unless maybe a few simple test
> programs with Qt's QThread, and such). But I haven't noticed
> any difference (other than, I would suspect, pthreads not working).
>
> So what does --enable-threads=win32 vs. --enable-threads=posix
> actually do?
Hi Frank,
The difference is in the internally gthread-layer of libgcc. For
"win32" model it uses just classical win32 API calls. for "posix" it
uses the posix-threading API.
The gthread-layer is in fact a duplicate of the pthread-API. Just not
all APIs are mandatory here. This was the reason why I preferred to
built up a compatible pthread-library ("winpthread"), which can be
used to build target-libraries as "posix" model on Windwos.
The issue about critical-sections and gthread (and also pthread) API
is, that not all locking-kinds can be modelled by it. The difference
on Windows for it is, that a critical section object provides
synchronization similar to that provided by a mutex object, except
that a critical section can be used *only* by the threads of a single
process.
(see
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682530%28v=vs.85%29.aspx
). This makes it pretty useless for many classical scenarios.
Regards,
Kai
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public