Hello,

Jeff Squyres, le Thu 11 Mar 2010 17:34:59 -0800, a écrit :
> On Mar 11, 2010, at 3:57 PM, Samuel Thibault wrote:
> 
> > > What *is* hwloc's policy about thread safety, anyway?
> > 
> > It would be odd to not be threadsafe, considering the target
> > applications :) and I believe hwloc is already.
> 
> Hmm.  I'm not so sure.  Consider:
> 
> 1. thread A calls hwloc_topology_init(&a)
> 2. thread A calls hwloc_topology_load(a)
> 3. thread A launches thread B
> 4. thread B calls hwloc_topology_get_*(a...)
> 5. thread A calls hwloc_topology_load(a)

Well, yes, of course :)

I mean "thread-safe" like libc is thread-safe: if you call functions
that modify a buffer concurrently, you're hosed :) But all the reading
functions, or working on separate topology objects are fine to run in
parallel.

> It depends on exactly what you mean by "thread safe" (kinda like MPI's 4 
> different levels of thread support).

It's between THREAD_MULTIPLE (for read operations) and THREAD_SERIALIZE
(for write operations on the same object).

That being said, we could easily add a mutex which we take in write
operations to become completely THREAD_MULTIPLE-safe, as there aren't so
many write operations.

Samuel

Reply via email to