guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread safe functions


From: Ken Raeburn
Subject: Re: thread safe functions
Date: Tue, 15 Feb 2011 11:00:51 -0500

On Feb 10, 2011, at 17:19, Andy Wingo wrote:
> Hey Ken,
> 
> I got tired of seeing your mail marked as starred in my inbox, so I
> decided to take a look at it ;-)

Thanks! :-)
I'm sorry I haven't had time in a while to investigate more.

>> symbols.c: I don't think 'symbols' is handled safely.  But this code is
>> all starting to run together in my mind. :-)
> 
> I think I fixed this one a month ago or so.

Hmm... maybe.  It looks to me like it'll probably be okay, *if* you assume that 
updates aren't seen out-of-order by another thread.  If updates can be seen out 
of order, then the newly allocated vector in scm_i_rehash may still be seen as 
having garbage values in its data slots by the time SCM_SET_HASHTABLE_VECTOR 
makes it visible to other threads that aren't using any synchronization 
primitives.

BTW, I like this writeup: 
http://www.cs.umd.edu/~pugh/java/memoryModel/AlphaReordering.html .  It shows 
how (on Alpha, with its weak memory ordering model) even an explicit memory 
barrier in the writing thread isn't enough to guarantee that a reading thread 
in another CPU will see changes "in order".

> At this point I got tired.  But sending this mail to the list will
> requeue this work, so hey...

Fair enough. :)

Ken


reply via email to

[Prev in Thread] Current Thread [Next in Thread]