Re: [PATCH 01/10] thread-utils: macros to unconditionally compile pthreads API

2018-10-27 Thread Duy Nguyen
On Sat, Oct 27, 2018 at 10:15 AM Jeff King wrote: > > On Sat, Oct 27, 2018 at 09:40:13AM +0200, Duy Nguyen wrote: > > > > We expect to be able to store a void pointer here and get it back, which > > > should work even for a single thread. Do we need something like: > > > > > > extern void *pthre

Re: [PATCH 01/10] thread-utils: macros to unconditionally compile pthreads API

2018-10-27 Thread Jeff King
On Sat, Oct 27, 2018 at 09:40:13AM +0200, Duy Nguyen wrote: > > We expect to be able to store a void pointer here and get it back, which > > should work even for a single thread. Do we need something like: > > > > extern void *pthread_specific_data; > > > > #define pthread_setspecific(key, dat

Re: [PATCH 01/10] thread-utils: macros to unconditionally compile pthreads API

2018-10-27 Thread Duy Nguyen
On Sat, Oct 27, 2018 at 9:31 AM Jeff King wrote: > > +#define pthread_setspecific(key, data) > > +#define pthread_getspecific(key) NULL > > We expect to be able to store a void pointer here and get it back, which > should work even for a single thread. Do we need something like: > > extern void

Re: [PATCH 01/10] thread-utils: macros to unconditionally compile pthreads API

2018-10-27 Thread Jeff King
On Sat, Oct 27, 2018 at 09:09:54AM +0200, Nguyễn Thái Ngọc Duy wrote: > +/* > + * macros instead of typedefs because pthread definitions may have > + * been pulled in by some system dependencies even though the user > + * wants to disable pthread. > + */ > +#define pthread_t int > +#define pthread

[PATCH 01/10] thread-utils: macros to unconditionally compile pthreads API

2018-10-27 Thread Nguyễn Thái Ngọc Duy
When built with NO_PTHREADS, the macros are used make the code build even though pthreads header and library may be missing. The code can still have different code paths for no threads support with HAVE_THREADS variable. There are of course impacts on no-pthreads builds: - data structure may get