1 There is code in recvbuff.c which adds a mutex around these structures but only on Windows.
2 Given that the OpenIndiana build of ntpd is sporadically multithreaded we also seem to need
3 a pthreads mutex to protect the critical section.
4 --- libntp/recvbuff.c.orig
7 # define LOCK_F() EnterCriticalSection(&FreeLock)
8 # define UNLOCK_F() LeaveCriticalSection(&FreeLock)
10 +#if defined(HAVE_SOLARIS_PRIVS)
12 +static pthread_mutex_t RecvLock = PTHREAD_MUTEX_INITIALIZER;
13 +static pthread_mutex_t FreeLock = PTHREAD_MUTEX_INITIALIZER;
15 +# define LOCK_R() pthread_mutex_lock(&RecvLock);
16 +# define UNLOCK_R() pthread_mutex_unlock(&RecvLock);
17 +# define LOCK_F() pthread_mutex_lock(&FreeLock);
18 +# define UNLOCK_F() pthread_mutex_unlock(&FreeLock);
21 # define LOCK_R() do {} while (FALSE)
22 # define UNLOCK_R() do {} while (FALSE)
23 # define LOCK_F() do {} while (FALSE)
24 # define UNLOCK_F() do {} while (FALSE)
29 static void uninit_recvbuff(void);