| 854 | #endif |
| 855 | |
| 856 | static xmlGlobalStatePtr |
| 857 | xmlGetThreadLocalStorage(int allowFailure) { |
| 858 | xmlGlobalState *gs; |
| 859 | |
| 860 | (void) allowFailure; |
| 861 | |
| 862 | #ifdef USE_TLS |
| 863 | gs = &globalState; |
| 864 | if (gs->initialized == 0) |
| 865 | xmlInitGlobalState(gs); |
| 866 | #elif defined(HAVE_POSIX_THREADS) |
| 867 | gs = (xmlGlobalState *) pthread_getspecific(globalkey); |
| 868 | if (gs == NULL) |
| 869 | gs = xmlNewGlobalState(allowFailure); |
| 870 | #elif defined(HAVE_WIN32_THREADS) |
| 871 | gs = (xmlGlobalState *) TlsGetValue(globalkey); |
| 872 | if (gs == NULL) |
| 873 | gs = xmlNewGlobalState(allowFailure); |
| 874 | #else |
| 875 | gs = NULL; |
| 876 | #endif |
| 877 | |
| 878 | return(gs); |
| 879 | } |
| 880 | |
| 881 | /* Define thread-local storage accessors with macro magic */ |
| 882 |
no test coverage detected