Re: pthread library related

2016-05-30 Thread Charles Cui
Hi Kamil, _SC_SEM_NSEMS_MAX is not the same with SEM_VALUE_MAX. The first one is used to limit the number of sems for a process, while the second is used to set the initial value for a semaphore. 2016-05-26 16:25 GMT-07:00 Kamil Rytarowski : > > > On 27.05.2016 00:02, Christos Zoulas wrote: >

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 1:43pm, charles.cui1...@gmail.com (Charles Cui) wrote: -- Subject: Re: pthread library related | I am not familiar with _nv() (are there examples in the netbsd code base? I | searched _nv() in nxr, but did not found anything meaningful.), | but if you want to use atomic operations, one

Re: pthread library related

2016-05-30 Thread Martin Husemann
On Mon, May 30, 2016 at 01:25:34PM -0700, Charles Cui wrote: > there is one remaining slot. And each of them will increase p_nsem by one > using atomic_inc, the results are we have 1 slot overused, but the error is > never detected. You will have to use a _nv() variant and use the return value to

Re: pthread library related

2016-05-30 Thread Charles Cui
Hi guys, I have attached 3 new patches. The first one is the porting of ad's work and fix of pthread_condattr_getclock. I did some changes to ad's work to make it work for the netbsd-current. The second one is the reimplementation of bsd signal. The third one is the missing kernel logic for _SC

Re: pthread library related

2016-05-30 Thread Martin Husemann
On Mon, May 30, 2016 at 03:34:20PM -0400, Christos Zoulas wrote: > It is not a function pointer; it is a function that takes as an argument > the new signal handler (function pointer) returns a function > pointer (the old signal handler function) Duh, wrong paranthization - I'll shut up. Martin

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 10:33am, charles.cui1...@gmail.com (Charles Cui) wrote: -- Subject: Re: pthread library related The bsd_signal patch looks good! christos

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 10:33am, charles.cui1...@gmail.com (Charles Cui) wrote: -- Subject: Re: pthread library related Inline comments. christos diff --git a/lib/libpthread/pthread.h b/lib/libpthread/pthread.h index 5970378..ed16d7c 100644 --- a/lib/libpthread/pthread.h +++ b/lib/libpthread/pthread.h @@ -94

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 10:33am, charles.cui1...@gmail.com (Charles Cui) wrote: -- Subject: Re: pthread library related Looks good, but be careful with whitespace in general: @@ -316,7 +316,7 @@ ksem_create(lwp_t *l, const char *name, ksem_t **ksret, mode_t mode, u_int val) if (val > SEM_VALUE_MAX) {

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 9:32pm, mar...@duskware.de (Martin Husemann) wrote: -- Subject: Re: pthread library related | On Mon, May 30, 2016 at 03:28:09PM -0400, Christos Zoulas wrote: | > On May 30, 8:29pm, mar...@duskware.de (Martin Husemann) wrote: | > -- Subject: Re: pthread library related | > | > | Do w

Re: pthread library related

2016-05-30 Thread Martin Husemann
On Mon, May 30, 2016 at 03:28:09PM -0400, Christos Zoulas wrote: > On May 30, 8:29pm, mar...@duskware.de (Martin Husemann) wrote: > -- Subject: Re: pthread library related > > | Do we really need this? Why is it a function pointer? > > It is the same as signal. OK. Why is "signal" a function po

Re: pthread library related

2016-05-30 Thread Christos Zoulas
On May 30, 8:29pm, mar...@duskware.de (Martin Husemann) wrote: -- Subject: Re: pthread library related | Do we really need this? Why is it a function pointer? It is the same as signal. | > The third one is the missing kernel logic for _SC_SEM_NSEMS_MAX. | | Why not use atomic_inc/atomic_dec fo

Re: pthread library related

2016-05-30 Thread Martin Husemann
On Mon, May 30, 2016 at 10:33:33AM -0700, Charles Cui wrote: > The second one is the reimplementation of bsd signal. Do we really need this? Why is it a function pointer? > The third one is the missing kernel logic for _SC_SEM_NSEMS_MAX. Why not use atomic_inc/atomic_dec for the p_nsem count (a