NetBSD-Users archive

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

Re: PTHREAD_MUTEX_INITIALIZER on 6.1.5 issues



On Tue, May 29, 2018 at 08:29:02AM +0200, Riccardo wrote:
> Hi all,
> 
> 
> I am testing build og GNUstep base (head) on NetBSD 6.1.5/sparc
> 
> Build fails with:
> 
>  Compiling file NSObject.m ...
> NSObject.m: In function '+[NSObject initialize]':
> NSObject.m:1049:34: error: expected expression before '{' token
> NSObject.m: At top level:
> 
> you can see the file here:
> https://github.com/gnustep/libs-base/blob/master/Source/NSObject.m
> 
> I bet the issue is with PTHREAD_MUTEX_INITIALIZER

The code is doing something strange there. PTHREAD_MUTEX_INITIALIZER is
only needed for static mutex initializations. In this case it is way
easier to just do:

	for (i = 0; i < LOCKCOUNT; i++)
	{
		pthread_mutex_init(&allocationLocks[i], NULL);
	}

As the name says it is an initializer, which does not necessarily mean
it is an rvalue (that you could just assign).

Martin


Home | Main Index | Thread Index | Old Index