mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-18 00:20:30 +00:00
Clean up threading code some more
This commit is contained in:
parent
6a3330d7c9
commit
654ceaba7d
28 changed files with 119 additions and 134 deletions
3
third_party/nsync/common.c
vendored
3
third_party/nsync/common.c
vendored
|
@ -18,6 +18,7 @@
|
|||
#include "libc/mem/mem.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/thread/thread.h"
|
||||
#include "libc/thread/tls.h"
|
||||
#include "third_party/nsync/atomic.h"
|
||||
#include "third_party/nsync/atomic.internal.h"
|
||||
#include "third_party/nsync/common.internal.h"
|
||||
|
@ -150,7 +151,7 @@ static nsync_dll_list_ free_waiters = NULL;
|
|||
/* free_waiters points to a doubly-linked list of free waiter structs. */
|
||||
static nsync_atomic_uint32_ free_waiters_mu; /* spinlock; protects free_waiters */
|
||||
|
||||
static _Thread_local waiter *waiter_for_thread;
|
||||
#define waiter_for_thread __get_tls()->tib_nsync
|
||||
|
||||
static void waiter_destroy (void *v) {
|
||||
waiter *w = (waiter *) v;
|
||||
|
|
3
third_party/sqlite3/mutex_unix.c
vendored
3
third_party/sqlite3/mutex_unix.c
vendored
|
@ -11,6 +11,7 @@
|
|||
*************************************************************************
|
||||
** This file contains the C functions that implement mutexes for pthreads
|
||||
*/
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/sqlite3/sqliteInt.inc"
|
||||
/* clang-format off */
|
||||
|
||||
|
@ -23,8 +24,6 @@
|
|||
*/
|
||||
#ifdef SQLITE_MUTEX_PTHREADS
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
/*
|
||||
** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields
|
||||
** are necessary under two condidtions: (1) Debug builds and (2) using
|
||||
|
|
3
third_party/sqlite3/sqlite3.mk
vendored
3
third_party/sqlite3/sqlite3.mk
vendored
|
@ -54,6 +54,7 @@ THIRD_PARTY_SQLITE3_A_DIRECTDEPS = \
|
|||
LIBC_STUBS \
|
||||
LIBC_SYSV \
|
||||
LIBC_SYSV_CALLS \
|
||||
LIBC_THREAD \
|
||||
LIBC_TIME \
|
||||
LIBC_TINYMATH \
|
||||
THIRD_PARTY_GDTOA \
|
||||
|
@ -110,7 +111,7 @@ THIRD_PARTY_SQLITE3_FLAGS = \
|
|||
-DHAVE_STRCHRNUL \
|
||||
-DHAVE_LOCALTIME_R \
|
||||
-DHAVE_MALLOC_USABLE_SIZE \
|
||||
-DSQLITE_THREADSAFE=0 \
|
||||
-DSQLITE_THREADSAFE=1 \
|
||||
-DSQLITE_MAX_EXPR_DEPTH=0 \
|
||||
-DSQLITE_DEFAULT_MEMSTATUS=0 \
|
||||
-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1 \
|
||||
|
|
2
third_party/sqlite3/threads.c
vendored
2
third_party/sqlite3/threads.c
vendored
|
@ -25,6 +25,7 @@
|
|||
** of multiple cores can do so, while also allowing applications to stay
|
||||
** single-threaded if desired.
|
||||
*/
|
||||
#include "libc/thread/thread.h"
|
||||
#include "third_party/sqlite3/sqliteInt.inc"
|
||||
/* clang-format off */
|
||||
|
||||
|
@ -34,7 +35,6 @@
|
|||
#if SQLITE_OS_UNIX && defined(SQLITE_MUTEX_PTHREADS) && SQLITE_THREADSAFE>0
|
||||
|
||||
#define SQLITE_THREADS_IMPLEMENTED 1 /* Prevent the single-thread code below */
|
||||
#include <pthread.h>
|
||||
|
||||
/* A running thread */
|
||||
struct SQLiteThread {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue