libc: use threaded mode

Issue #725
This commit is contained in:
Christian Prochaska 2023-10-20 06:20:56 +02:00 committed by Christian Helmuth
parent 002eb6f649
commit ebea6fb23f
2 changed files with 9 additions and 0 deletions

View File

@ -25,6 +25,7 @@
#include <errno.h>
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h> /* __isthreaded */
#include <stdlib.h> /* malloc, free */
/* libc-internal includes */
@ -74,6 +75,9 @@ size_t Pthread::_tls_pointer_offset;
void Libc::Pthread::Thread_object::entry()
{
/* use threaded mode in FreeBSD libc code */
__isthreaded = 1;
/*
* Obtain stack attributes of new thread for
* 'pthread_attr_get_np()'

View File

@ -22,6 +22,7 @@
/* libc includes */
#include <libc/allocator.h>
#include <errno.h>
#include <stdio.h> /* __isthreaded */
/* libc-internal includes */
#include <internal/init.h>
@ -172,6 +173,10 @@ int Libc::pthread_create_from_thread(pthread_t *thread, Thread &t, void *stack_a
return EAGAIN;
*thread = thread_obj;
/* use threaded mode in FreeBSD libc code */
__isthreaded = 1;
return 0;
}