Browse Source

Make errno thread local

Mateusz Mikuła 5 years ago
parent
commit
ff94798253
3 changed files with 3 additions and 4 deletions
  1. 1 2
      include/bits/errno.h
  2. 1 1
      src/c/dlmalloc.c
  3. 1 1
      src/platform/mod.rs

+ 1 - 2
include/bits/errno.h

@@ -7,8 +7,7 @@ extern "C" {
 
 #define ENOTSUP EOPNOTSUPP
 
-//TODO extern __thread int errno;
-extern int errno;
+extern __thread int errno;
 
 #ifdef __cplusplus
 } // extern "C"

+ 1 - 1
src/c/dlmalloc.c

@@ -544,7 +544,7 @@ MAX_RELEASE_CHECK_RATE   default: 4095 unless not HAVE_MMAP
 #define ENOMEM 12
 #define EINVAL 22
 
-extern int errno;
+extern __thread int errno;
 
 void abort(void);
 void *memcpy(void *dest, const void *src, size_t n);

+ 1 - 1
src/platform/mod.rs

@@ -34,7 +34,7 @@ pub mod rlb;
 use self::types::*;
 pub mod types;
 
-//TODO #[thread_local]
+#[thread_local]
 #[allow(non_upper_case_globals)]
 #[no_mangle]
 pub static mut errno: c_int = 0;