Threading Question

Alex Rønne Petersen alex at lycus.org
Tue Oct 30 11:06:41 PDT 2012


On 30-10-2012 19:04, Sean Kelly wrote:
> On Oct 25, 2012, at 11:18 PM, Jacob Carlborg <doob at me.com> wrote:
>
>> On 2012-10-26 01:18, Sean Kelly wrote:
>>> On Oct 25, 2012, at 4:12 PM, Alex Rønne Petersen <alex at lycus.org> wrote:
>>>>
>>>> What's used on OS X? I forget...
>>>
>>> The method used is similar to how GC works on Windows--there's a kernel call that can be used to explicitly suspend a thread.  I can't remember the function name offhand though.
>>
>> The Posix functions weren't working properly?
>
> The semaphore implementation for OSX is not signal-safe.  Originally, druntime used the signal approach on OSX and had deadlock issues in the signal handler (OSX semaphores wrap a global mutex to obtain something from a shared pool).  Also, semaphores on OSX are just ridiculously slow.  The current method for suspending and scanning threads on OSX is much faster.  I wish Posix in general had the same feature.  Using signals is really a hack.
>
> It may be worth dropping use of SIGUSR1/2 in favor of the realtime signals as well, since SIGUSR1/2 are in pretty common use.
>

Real time signals as in?

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d-learn mailing list