Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!news.informatik.hu-berlin.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c,comp.programming.threads,comp.unix.programmer Subject: Re: POSIX threads hard to implement in Windows Date: Fri, 08 Jul 2011 08:07:30 +1200 Lines: 38 Message-ID: <97mi1gFbcvU4@mid.individual.net> References: <4e116c59$0$13719$426a34cc@news.free.fr> <5fa80219-4bc8-4af8-9766-54501eb5ab90@j15g2000yqf.googlegroups.com> <97ek3iFq2bU2@mid.individual.net> <4e13c801$0$20925$a729d347@news.telepac.pt> <4e13d4a7$0$20921$a729d347@news.telepac.pt> <37pfe8-4gl.ln1@jones.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net bW+dW07YKuHnRRrzLfhgiwAPA43RTKuH+c8KXmdDuiB3+jNRzQ Cancel-Lock: sha1:erHxG76AFs2dXIZAJDofTOyS9zQ= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c:7877 comp.programming.threads:388 comp.unix.programmer:898 On 07/ 8/11 06:21 AM, William Ahern wrote: > In comp.unix.programmer Noob wrote: >> James Kuyper wrote: >>> Lawrence Jones wrote: >>> >>>> Keith Thompson wrote: >>>> >>>>> I'm not very familiar with this area, but why would just >>>>> incorporating POSIX threads (or perhaps a subset of POSIX threads) >>>>> into the C standard not have been a good solution? >>>> >>>> My understanding, from people who know a whole lot more about it than I >>>> do, is that POSIX threads cannot be implemented on top of Windows >>>> because it presupposes a bunch of POSIX features that Windows doesn't >>>> provide, at least in the form that POSIX threads requires. >>> >>> Could you ask those people to provide a more detailed explanation of the >>> problem? I doubt that a naked assertion will convince Rui Maciel, and >>> I'm curious about the reasons myself. > > POSIX threads can be implemented quite comprehensively on Windows: > > http://sourceware.org/pthreads-win32/conformance.html > > But anyone who has used POSIX threads and Windows' native API quickly learns > that they're quite different approaches. The biggest difference that I'm > aware of is that Windows' mutexes cannot be statically initialized. > pthreads-win32 handles this with a global Windows' CriticalSection in > pthread_mutex_lock(). AFAIK, the C1x proposal doesn't allow statically > initialized objects, presumably so the interface can be implemented atop > Windows' API without such ugliness. Does the windows API support process shared mutexes? The C1x proposal doesn't include them probably because the process model is beyond the C standard. -- Ian Collins