tst-tls-at-ctor.c 361 B

123456789101112131415161718192021
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <tls.h>
  4. #define TLS_VAR_INIT_VALUE 99
  5. #ifdef USE_TLS
  6. extern __thread int tls_var;
  7. #endif
  8. int main(void)
  9. {
  10. int ret = EXIT_SUCCESS;
  11. #ifdef USE_TLS
  12. if (tls_var != TLS_VAR_INIT_VALUE) {
  13. printf("tls_var = %d - Expected value = %d\n", tls_var, TLS_VAR_INIT_VALUE);
  14. ret = EXIT_FAILURE;
  15. }
  16. #endif
  17. return ret;
  18. }