diff options
Diffstat (limited to 'src/lib/libc/include')
| -rw-r--r-- | src/lib/libc/include/thread_private.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/lib/libc/include/thread_private.h b/src/lib/libc/include/thread_private.h index c2e0cf0b3f..81caaaae68 100644 --- a/src/lib/libc/include/thread_private.h +++ b/src/lib/libc/include/thread_private.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: thread_private.h,v 1.27 2016/05/07 19:05:22 guenther Exp $ */ | 1 | /* $OpenBSD: thread_private.h,v 1.28 2016/09/01 10:41:02 otto Exp $ */ |
| 2 | 2 | ||
| 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ | 3 | /* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */ |
| 4 | 4 | ||
| @@ -7,6 +7,9 @@ | |||
| 7 | 7 | ||
| 8 | #include <stdio.h> /* for FILE and __isthreaded */ | 8 | #include <stdio.h> /* for FILE and __isthreaded */ |
| 9 | 9 | ||
| 10 | #define _MALLOC_MUTEXES 4 | ||
| 11 | void _malloc_init(int); | ||
| 12 | |||
| 10 | /* | 13 | /* |
| 11 | * The callbacks needed by libc to handle the threaded case. | 14 | * The callbacks needed by libc to handle the threaded case. |
| 12 | * NOTE: Bump the version when you change the struct contents! | 15 | * NOTE: Bump the version when you change the struct contents! |
| @@ -72,8 +75,8 @@ struct thread_callbacks { | |||
| 72 | void (*tc_flockfile)(FILE *); | 75 | void (*tc_flockfile)(FILE *); |
| 73 | int (*tc_ftrylockfile)(FILE *); | 76 | int (*tc_ftrylockfile)(FILE *); |
| 74 | void (*tc_funlockfile)(FILE *); | 77 | void (*tc_funlockfile)(FILE *); |
| 75 | void (*tc_malloc_lock)(void); | 78 | void (*tc_malloc_lock)(int); |
| 76 | void (*tc_malloc_unlock)(void); | 79 | void (*tc_malloc_unlock)(int); |
| 77 | void (*tc_atexit_lock)(void); | 80 | void (*tc_atexit_lock)(void); |
| 78 | void (*tc_atexit_unlock)(void); | 81 | void (*tc_atexit_unlock)(void); |
| 79 | void (*tc_atfork_lock)(void); | 82 | void (*tc_atfork_lock)(void); |
| @@ -137,8 +140,8 @@ extern void *__THREAD_NAME(serv_mutex); | |||
| 137 | #define _MUTEX_LOCK(mutex) do {} while (0) | 140 | #define _MUTEX_LOCK(mutex) do {} while (0) |
| 138 | #define _MUTEX_UNLOCK(mutex) do {} while (0) | 141 | #define _MUTEX_UNLOCK(mutex) do {} while (0) |
| 139 | #define _MUTEX_DESTROY(mutex) do {} while (0) | 142 | #define _MUTEX_DESTROY(mutex) do {} while (0) |
| 140 | #define _MALLOC_LOCK() do {} while (0) | 143 | #define _MALLOC_LOCK(n) do {} while (0) |
| 141 | #define _MALLOC_UNLOCK() do {} while (0) | 144 | #define _MALLOC_UNLOCK(n) do {} while (0) |
| 142 | #define _ATEXIT_LOCK() do {} while (0) | 145 | #define _ATEXIT_LOCK() do {} while (0) |
| 143 | #define _ATEXIT_UNLOCK() do {} while (0) | 146 | #define _ATEXIT_UNLOCK() do {} while (0) |
| 144 | #define _ATFORK_LOCK() do {} while (0) | 147 | #define _ATFORK_LOCK() do {} while (0) |
| @@ -184,15 +187,15 @@ extern void *__THREAD_NAME(serv_mutex); | |||
| 184 | /* | 187 | /* |
| 185 | * malloc lock/unlock prototypes and definitions | 188 | * malloc lock/unlock prototypes and definitions |
| 186 | */ | 189 | */ |
| 187 | #define _MALLOC_LOCK() \ | 190 | #define _MALLOC_LOCK(n) \ |
| 188 | do { \ | 191 | do { \ |
| 189 | if (__isthreaded) \ | 192 | if (__isthreaded) \ |
| 190 | _thread_cb.tc_malloc_lock(); \ | 193 | _thread_cb.tc_malloc_lock(n); \ |
| 191 | } while (0) | 194 | } while (0) |
| 192 | #define _MALLOC_UNLOCK() \ | 195 | #define _MALLOC_UNLOCK(n) \ |
| 193 | do { \ | 196 | do { \ |
| 194 | if (__isthreaded) \ | 197 | if (__isthreaded) \ |
| 195 | _thread_cb.tc_malloc_unlock(); \ | 198 | _thread_cb.tc_malloc_unlock(n); \ |
| 196 | } while (0) | 199 | } while (0) |
| 197 | 200 | ||
| 198 | #define _ATEXIT_LOCK() \ | 201 | #define _ATEXIT_LOCK() \ |
