bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH] libports: fix the thread counts in case the thread creation


From: Samuel Thibault
Subject: Re: [PATCH] libports: fix the thread counts in case the thread creation fails
Date: Sun, 10 Nov 2013 11:54:20 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Neal H. Walfield, le Sun 10 Nov 2013 11:38:04 +0100, a écrit :
> At Sat, 9 Nov 2013 18:21:51 +0100,
> Samuel Thibault wrote:
> > > +       pthread_spin_lock (&lock);
> > > +       totalthreads--;
> > > +       nreqthreads--;
> > > +       pthread_spin_unlock (&lock);
> 
> It might be a good idea use atomic operations instead of the spin lock
> (which is what the spin lock is using behind the scenes anyways).

It may not be possible: further down there is a decision taken depending
on totalthreads/nreqthreads becoming 1, and thus you need a spinlock to
make that coherent with the ++/--.

Samuel



reply via email to

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