Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Stefan Beller
On Wed, Oct 26, 2016 at 1:40 PM, Johannes Sixt wrote: > Am 26.10.2016 um 22:26 schrieb Jeff King: >> >> On Wed, Oct 26, 2016 at 10:25:38PM +0200, Johannes Sixt wrote: >> >>> Am 26.10.2016 um 21:51 schrieb Stefan Beller: it is very convenient to not have to explicitly

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Stefan Beller
On Wed, Oct 26, 2016 at 1:26 PM, Jeff King wrote: > On Wed, Oct 26, 2016 at 10:25:38PM +0200, Johannes Sixt wrote: > >> Am 26.10.2016 um 21:51 schrieb Stefan Beller: >> > it is >> > very convenient to not have to explicitly initialize mutexes? >> >> Not to initialize a mutex is

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Johannes Sixt
Am 26.10.2016 um 22:26 schrieb Jeff King: On Wed, Oct 26, 2016 at 10:25:38PM +0200, Johannes Sixt wrote: Am 26.10.2016 um 21:51 schrieb Stefan Beller: it is very convenient to not have to explicitly initialize mutexes? Not to initialize a mutex is still wrong for pthreads. I think Stefan

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Jeff King
On Wed, Oct 26, 2016 at 10:25:38PM +0200, Johannes Sixt wrote: > Am 26.10.2016 um 21:51 schrieb Stefan Beller: > > it is > > very convenient to not have to explicitly initialize mutexes? > > Not to initialize a mutex is still wrong for pthreads. I think Stefan was being loose with his wording.

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Johannes Sixt
Am 26.10.2016 um 21:51 schrieb Stefan Beller: it is very convenient to not have to explicitly initialize mutexes? Not to initialize a mutex is still wrong for pthreads. -- Hannes

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Jeff King
On Wed, Oct 26, 2016 at 12:51:02PM -0700, Stefan Beller wrote: > > I seem to recall this does not work on Windows, where the pthread > > functions are thin wrappers over CRITICAL_SECTION. Other threaded code > > in git does an explicit setup step before entering threaded sections. > > E.g., see

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Stefan Beller
On Wed, Oct 26, 2016 at 5:15 AM, Jeff King wrote: > On Wed, Oct 26, 2016 at 11:35:58AM +0200, Simon Ruderich wrote: > >> > static pthread_mutex_t attr_mutex; >> > -#define attr_lock()pthread_mutex_lock(_mutex) >> > +static inline void attr_lock(void) >> > +{ >> > + static int

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Duy Nguyen
On Tue, Oct 25, 2016 at 2:18 AM, Stefan Beller wrote: > On Mon, Oct 24, 2016 at 11:55 AM, Junio C Hamano wrote: > >> >> Make that a double-asterisk. The same problem appears in an updated >> example in technical/api-gitattributes.txt doc, but the example

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Duy Nguyen
On Sun, Oct 23, 2016 at 6:32 AM, Stefan Beller wrote: > This revamps the API of the attr subsystem to be thread safe. > Before we had the question and its results in one struct type. > The typical usage of the API was > > static struct git_attr_check *check; > > if

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Jeff King
On Wed, Oct 26, 2016 at 11:35:58AM +0200, Simon Ruderich wrote: > > static pthread_mutex_t attr_mutex; > > -#define attr_lock()pthread_mutex_lock(_mutex) > > +static inline void attr_lock(void) > > +{ > > + static int initialized; > > + > > + if (!initialized) { > > +

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Simon Ruderich
On Wed, Oct 26, 2016 at 10:52:23AM +0200, Johannes Schindelin wrote: > diff --git a/attr.c b/attr.c > index d5a6aa9..6933504 100644 > --- a/attr.c > +++ b/attr.c > @@ -50,7 +50,16 @@ static struct git_attr *(git_attr_hash[HASHSIZE]); > #ifndef NO_PTHREADS > > static pthread_mutex_t attr_mutex; >

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-26 Thread Johannes Schindelin
Hi Stefan, On Sat, 22 Oct 2016, Stefan Beller wrote: > @@ -46,6 +47,19 @@ struct git_attr { > static int attr_nr; > static struct git_attr *(git_attr_hash[HASHSIZE]); > > +#ifndef NO_PTHREADS > + > +static pthread_mutex_t attr_mutex; > +#define attr_lock() pthread_mutex_lock(_mutex)

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-24 Thread Stefan Beller
On Mon, Oct 24, 2016 at 11:55 AM, Junio C Hamano wrote: > > Make that a double-asterisk. The same problem appears in an updated > example in technical/api-gitattributes.txt doc, but the example in > the commit log message (below) is correct. The implementation is actually

Re: [PATCH 27/36] attr: convert to new threadsafe API

2016-10-24 Thread Junio C Hamano
Stefan Beller writes: > This revamps the API of the attr subsystem to be thread safe. > Before we had the question and its results in one struct type. > The typical usage of the API was > > static struct git_attr_check *check; > > if (!check) > check =

[PATCH 27/36] attr: convert to new threadsafe API

2016-10-22 Thread Stefan Beller
This revamps the API of the attr subsystem to be thread safe. Before we had the question and its results in one struct type. The typical usage of the API was static struct git_attr_check *check; if (!check) check = git_attr_check_initl("text", NULL); git_check_attr(path,