Overview
Comment: | Use thread_local instead of __thread
If threads.h exists, the thread_local from there is used. If it doesn't, |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
c701e89b834e8c571d507aa0d4459e0d |
User & Date: | js on 2014-05-14 20:19:05 |
Other Links: | manifest | tags |
Context
2014-05-14
| ||
20:28 | Always use __foo__ instead of foo for attributes check-in: e35b10115e user: js tags: trunk | |
20:19 | Use thread_local instead of __thread check-in: c701e89b83 user: js tags: trunk | |
18:26 | Try -std=c1x when -std=c11 is unavailable check-in: 7326a487c0 user: js tags: trunk | |
Changes
Modified configure.ac from [ba69b79b62] to [c1957ea278].
︙ | |||
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + | AC_SUBST(USE_SRCS_THREADS, '${SRCS_THREADS}') AC_SUBST(USE_INCLUDES_THREADS, '${INCLUDES_THREADS}') AC_ARG_ENABLE(compiler-tls, AS_HELP_STRING([--disable-compiler-tls], [disable compiler thread local storage])) AS_IF([test x"$enable_compiler_tls" != x"no"], [ AC_CHECK_HEADERS(threads.h, [ AC_DEFINE(OF_HAVE_THREADS_H, 1, [Whether we have threads.h]) ]) AC_MSG_CHECKING(whether _Thread_local works) AC_TRY_LINK([ static _Thread_local int x = 0; ], [ x++; ], [ AS_IF([test x"$enable_shared" != x"no"], [ old_OBJCFLAGS="$OBJCFLAGS" OBJCFLAGS="$OBJCFLAGS -fPIC" AC_TRY_COMPILE([ static _Thread_local int x = 0; ], [ x++; ], [ AC_MSG_RESULT(yes) AC_DEFINE(OF_HAVE__THREAD_LOCAL, 1, [Whether _Thread_local works]) ], [ AC_MSG_RESULT(no) ]) OBJCFLAGS="$old_OBJCFLAGS" ], [ AC_MSG_RESULT(yes) AC_DEFINE(OF_HAVE__THREAD_LOCAL, 1, [Whether _Thread_local works]) ]) ], [ AC_MSG_RESULT(no) ]) AC_MSG_CHECKING(whether __thread works) AC_TRY_LINK([ /* It seems __thread is buggy with GCC 4.1 */ #if __GNUC__ == 4 && __GNUC_MINOR__ < 2 # error buggy #endif __thread int x = 0; ], [ x++; ], [ AS_IF([test x"$enable_shared" != x"no"], [ old_OBJCFLAGS="$OBJCFLAGS" OBJCFLAGS="$OBJCFLAGS -fPIC" AC_TRY_COMPILE([ __thread int x = 0; ], [ x++; ], [ AC_MSG_RESULT(yes) |
︙ |
Modified src/OFAutoreleasePool.m from [afda14705e] to [c6736b8348].
︙ | |||
27 28 29 30 31 32 33 | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | - + | #endif #import "autorelease.h" #define MAX_CACHE_SIZE 0x20 #if defined(OF_HAVE_COMPILER_TLS) |
︙ |
Modified src/OFObject.h from [14f340cddc] to [b5db2a6441].
︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | + + + + + + + + + + + + | /*! @file */ #if defined(__GNUC__) # define restrict __restrict__ #elif __STDC_VERSION__ < 199901L # define restrict #endif #if defined(OF_HAVE__THREAD_LOCAL) # define OF_HAVE_COMPILER_TLS # ifdef OF_HAVE_THREADS_H # include <threads.h> # else # define thread_local _Thread_local # endif #elif defined(OF_HAVE___THREAD) # define OF_HAVE_COMPILER_TLS # define thread_local __thread #endif #ifndef __has_feature # define __has_feature(x) 0 #endif #ifndef __has_attribute # define __has_attribute(x) 0 |
︙ |
Modified src/autorelease.m from [81cc6ed979] to [2dc209441b].
︙ | |||
26 27 28 29 30 31 32 | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - - - + + + | # import "threading.h" #endif #import "macros.h" #import "autorelease.h" #if defined(OF_HAVE_COMPILER_TLS) |
︙ |
Modified src/objfw-defs.h.in from [b64e054749] to [41bed793cb].
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | - + + | #undef OF_APPLE_RUNTIME #undef OF_BIG_ENDIAN #undef OF_FLOAT_BIG_ENDIAN #undef OF_HAVE_ASPRINTF #undef OF_HAVE_ATOMIC_OPS #undef OF_HAVE_BUILTIN_BSWAP16 #undef OF_HAVE_BUILTIN_BSWAP32 #undef OF_HAVE_BUILTIN_BSWAP64 #undef OF_HAVE_CHMOD #undef OF_HAVE_CHOWN |