[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lockless thread management in libports (was: [PATCH] libports: fix the t
From: |
Justus Winter |
Subject: |
lockless thread management in libports (was: [PATCH] libports: fix the thread counts in case the thread creation fails) |
Date: |
Mon, 11 Nov 2013 21:12:33 +0100 |
Hi :)
> > > 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 ++/--.
>
> Too bad. Perhaps combining the quantities into a single word as
> follows would work:
>
> atomic.add(threads, 1<<16 | 1)
>
> This has the further advantage of reducing the number of atomic
> operations.
Something along the lines of the following patch? I haven't really
tested this, but a superficial test with a tmpfs translator did not
turn up any obvious problems.
Justus
- [PATCH] libports: fix the thread counts in case the thread creation fails, Justus Winter, 2013/11/09
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Samuel Thibault, 2013/11/09
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Neal H. Walfield, 2013/11/10
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Samuel Thibault, 2013/11/10
- Re: [PATCH] libports: fix the thread counts in case the thread creation fails, Neal H. Walfield, 2013/11/10
- lockless thread management in libports (was: [PATCH] libports: fix the thread counts in case the thread creation fails),
Justus Winter <=
- [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/11
- Re: [PATCH] libports: implement lockless management of threads, Neal H. Walfield, 2013/11/11
- Re: [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/12
- Re: [PATCH] libports: implement lockless management of threads, Samuel Thibault, 2013/11/12
- Re: [PATCH] libports: implement lockless management of threads, Emilio Pozuelo Monfort, 2013/11/13
- Re: [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/15
- [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/15
- Re: [PATCH] libports: implement lockless management of threads, Samuel Thibault, 2013/11/16
- Re: [PATCH] libports: implement lockless management of threads, Justus Winter, 2013/11/16
- Re: [PATCH] libports: implement lockless management of threads, Richard Braun, 2013/11/16