tst-tls-at-ctor.c 344 B

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