Skip to content

Commit

Permalink
Make pthread mutex non-recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Sep 1, 2024
1 parent 7c83f4a commit cca0edd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libc/intrin/pthreadlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
╚─────────────────────────────────────────────────────────────────────────────*/
#include "libc/thread/posixthread.internal.h"

pthread_mutex_t _pthread_lock_obj = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
pthread_mutex_t _pthread_lock_obj = PTHREAD_MUTEX_INITIALIZER;

void _pthread_lock(void) {
pthread_mutex_lock(&_pthread_lock_obj);
Expand Down
2 changes: 1 addition & 1 deletion libc/proc/fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static void _onfork_child(void) {
__proc_wipe();
__fds_lock_obj = (pthread_mutex_t)PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
_rand64_lock_obj = (pthread_mutex_t)PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
_pthread_lock_obj = (pthread_mutex_t)PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
_pthread_lock_obj = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;
atomic_store_explicit(&__maps.lock, 0, memory_order_relaxed);
if (_weaken(_pthread_onfork_child))
_weaken(_pthread_onfork_child)();
Expand Down
4 changes: 2 additions & 2 deletions libc/str/wcwidth.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ static const unsigned char wtable[] = {

int wcwidth(wchar_t wc)
{
if (wc < 0xff) {
if (wc >= 0)
if ((int)wc < 0xff) {
if ((int)wc >= 0)
return ((wc+1) & 0x7f) >= 0x21 ? 1 : wc ? -1 : 0;
return -1;
}
Expand Down

0 comments on commit cca0edd

Please sign in to comment.