mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-20 06:07:59 +00:00
libc: thread local errno support
Store errno in pthread objects, return member upon call to '__error()'. This became necessary in order to make errno thread-safe. Note, any call to libc code from a non-pthread (beside the first entrypoint) is not supported. issue #3568
This commit is contained in:
parent
9767c4db0e
commit
9c372c36c1
@ -13,9 +13,9 @@
|
||||
* under the terms of the GNU Affero General Public License version 3.
|
||||
*/
|
||||
|
||||
static int private_errno;
|
||||
#include <internal/pthread.h>
|
||||
|
||||
extern "C" int *__error(void)
|
||||
{
|
||||
return &private_errno;
|
||||
return &pthread_self()->thread_local_errno;
|
||||
}
|
||||
|
@ -180,6 +180,8 @@ struct Libc::Pthread : Noncopyable, Thread::Tls::Base
|
||||
|
||||
public:
|
||||
|
||||
int thread_local_errno = 0;
|
||||
|
||||
/**
|
||||
* Constructor for threads created via 'pthread_create'
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user