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

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

 



On Sat, Oct 27, 2018 at 9:31 AM Jeff King <peff@xxxxxxxx> 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 *pthread_specific_data;
>
>   #define pthread_setspecific(key, data) do { \
>         pthread_specific_data = data; \
>   } while(0)
>
>   void pthread_getspecific(key) pthread_specific_data

The data is per key though so a correct implementation may involve a
hashmap or a list. It does simplify index-pack which has to fall back
to nothread_data when pthreads is not available. But with index-pack
being the only call site that can take advantage of this
(run-command.c probably will use real pthreads library anyway), I'm
not sure if it's worth really implementing these functions.
-- 
Duy



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux