Userland spinlocks bad. Sleep locks good.

Use the latter for gdtoa.

Requested by:	deischen (far too long ago)
This commit is contained in:
David Schultz 2003-06-21 08:20:14 +00:00
parent 97679e71b0
commit d086ded323
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=116652
2 changed files with 16 additions and 10 deletions

View File

@ -188,7 +188,10 @@ THIS SOFTWARE.
#include "stdlib.h"
#include "string.h"
#include "libc_private.h"
#include "spinlock.h"
#include "namespace.h"
#include <pthread.h>
#include "un-namespace.h"
#ifdef KR_headers
#define Char char
@ -465,14 +468,14 @@ extern double rnd_prod(double, double), rnd_quot(double, double);
#endif
#define MULTIPLE_THREADS
extern spinlock_t __gdtoa_locks[2];
#define ACQUIRE_DTOA_LOCK(n) do { \
if (__isthreaded) \
_SPINLOCK(&__gdtoa_locks[n]); \
extern pthread_mutex_t __gdtoa_locks[2];
#define ACQUIRE_DTOA_LOCK(n) do { \
if (__isthreaded) \
_pthread_mutex_lock(&__gdtoa_locks[n]); \
} while(0)
#define FREE_DTOA_LOCK(n) do { \
if (__isthreaded) \
_SPINUNLOCK(&__gdtoa_locks[n]); \
#define FREE_DTOA_LOCK(n) do { \
if (__isthreaded) \
_pthread_mutex_unlock(&__gdtoa_locks[n]); \
} while(0)
#define Kmax 15

View File

@ -5,6 +5,9 @@
* $FreeBSD$
*/
#include "spinlock.h"
#include <pthread.h>
spinlock_t __gdtoa_locks[2];
pthread_mutex_t __gdtoa_locks[] = {
PTHREAD_MUTEX_INITIALIZER,
PTHREAD_MUTEX_INITIALIZER
};