Re: [PATCH 1/2] Implement basic sleeping locks for gnumach.

2017-01-29 Thread Agustina Arzille
On 2017-01-29 21:34, Samuel Thibault wrote: Agustina Arzille, on Sun 29 Jan 2017 21:11:12 -0300, wrote: On 2017-01-29 17:44, Samuel Thibault wrote: >Agustina Arzille, on Sun 29 Jan 2017 16:46:45 -0300, wrote: > >There is just one thing I'm a bit afraid of: the code is assuming that >the only rea

Re: [PATCH 1/2] Implement basic sleeping locks for gnumach.

2017-01-29 Thread Samuel Thibault
Agustina Arzille, on Sun 29 Jan 2017 21:11:12 -0300, wrote: > On 2017-01-29 17:44, Samuel Thibault wrote: > >Agustina Arzille, on Sun 29 Jan 2017 16:46:45 -0300, wrote: > > > >There is just one thing I'm a bit afraid of: the code is assuming that > >the only reason why the locker thread is awakened

Re: [PATCH 1/2] Implement basic sleeping locks for gnumach.

2017-01-29 Thread Agustina Arzille
On 2017-01-29 17:44, Samuel Thibault wrote: Agustina Arzille, on Sun 29 Jan 2017 16:46:45 -0300, wrote: There is just one thing I'm a bit afraid of: the code is assuming that the only reason why the locker thread is awakened is that it was given the mutex control. Is that guaranteed? Well, th

Re: [PATCH 1/2] Implement basic sleeping locks for gnumach.

2017-01-29 Thread Samuel Thibault
Agustina Arzille, on Sun 29 Jan 2017 16:46:45 -0300, wrote: > >T1 atomic_cas(), gets the mutex > >T2 fails atomic_cas() > >T2 simple_lock() > >T1 atomic_cas() to release the mutex > >T2 reads KMUTEX_AVAIL in locked_swap > >T3 atomic_cas(), gets the mutex > >T2 writes KMUTEX_CONTENDED, gets KMUTEX_A

Re: [PATCH 1/2] Implement basic sleeping locks for gnumach.

2017-01-29 Thread Agustina Arzille
On 2017-01-28 21:03, Samuel Thibault wrote: Hello, Agustina Arzille, on Thu 19 Jan 2017 10:00:32 -0500, wrote: +/* Atomically compare *PTR with EXP and set it to NVAL if they're equal. + * Evaluates to a boolean, indicating whether the comparison was successful.*/ +#define atomic_cas(ptr, exp