mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-21 14:53:44 +03:00
applied patch from Marcin 'Shard' Konicki to provide BeOS thread support.
* nanoftp.c nanohttp.c testThreads.c threads.c: applied patch from Marcin 'Shard' Konicki to provide BeOS thread support. Daniel
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
Wed Oct 29 14:37:40 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
|
* nanoftp.c nanohttp.c testThreads.c threads.c: applied patch from
|
||||||
|
Marcin 'Shard' Konicki to provide BeOS thread support.
|
||||||
|
|
||||||
Wed Oct 29 14:20:14 CET 2003 Daniel Veillard <daniel@veillard.com>
|
Wed Oct 29 14:20:14 CET 2003 Daniel Veillard <daniel@veillard.com>
|
||||||
|
|
||||||
* xmlschemas.c include/libxml/xmlschemas.h: applied patch
|
* xmlschemas.c include/libxml/xmlschemas.h: applied patch
|
||||||
|
@@ -2221,10 +2221,10 @@ static
|
|||||||
void ftpData(void *userData, const char *data, int len) {
|
void ftpData(void *userData, const char *data, int len) {
|
||||||
if (userData == NULL) return;
|
if (userData == NULL) return;
|
||||||
if (len <= 0) {
|
if (len <= 0) {
|
||||||
fclose(userData);
|
fclose((FILE*)userData);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fwrite(data, len, 1, userData);
|
fwrite(data, len, 1, (FILE*)userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
12
nanohttp.c
12
nanohttp.c
@@ -1314,7 +1314,7 @@ retry:
|
|||||||
if (contentType && *contentType)
|
if (contentType && *contentType)
|
||||||
blen += strlen(*contentType) + 16;
|
blen += strlen(*contentType) + 16;
|
||||||
blen += strlen(method) + strlen(ctxt->path) + 24;
|
blen += strlen(method) + strlen(ctxt->path) + 24;
|
||||||
bp = xmlMallocAtomic(blen);
|
bp = (char*)xmlMallocAtomic(blen);
|
||||||
if ( bp == NULL ) {
|
if ( bp == NULL ) {
|
||||||
xmlNanoHTTPFreeCtxt( ctxt );
|
xmlNanoHTTPFreeCtxt( ctxt );
|
||||||
xmlHTTPErrMemory("allocating header buffer");
|
xmlHTTPErrMemory("allocating header buffer");
|
||||||
@@ -1616,7 +1616,7 @@ xmlNanoHTTPAuthHeader(void *ctx) {
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlNanoHTTPContentLength( void * ctx ) {
|
xmlNanoHTTPContentLength( void * ctx ) {
|
||||||
xmlNanoHTTPCtxtPtr ctxt = ctx;
|
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr)ctx;
|
||||||
|
|
||||||
return ( ( ctxt == NULL ) ? -1 : ctxt->ContentLength );
|
return ( ( ctxt == NULL ) ? -1 : ctxt->ContentLength );
|
||||||
}
|
}
|
||||||
@@ -1631,7 +1631,7 @@ xmlNanoHTTPContentLength( void * ctx ) {
|
|||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
xmlNanoHTTPRedir( void * ctx ) {
|
xmlNanoHTTPRedir( void * ctx ) {
|
||||||
xmlNanoHTTPCtxtPtr ctxt = ctx;
|
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr)ctx;
|
||||||
|
|
||||||
return ( ( ctxt == NULL ) ? NULL : ctxt->location );
|
return ( ( ctxt == NULL ) ? NULL : ctxt->location );
|
||||||
}
|
}
|
||||||
@@ -1646,7 +1646,7 @@ xmlNanoHTTPRedir( void * ctx ) {
|
|||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
xmlNanoHTTPEncoding( void * ctx ) {
|
xmlNanoHTTPEncoding( void * ctx ) {
|
||||||
xmlNanoHTTPCtxtPtr ctxt = ctx;
|
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr)ctx;
|
||||||
|
|
||||||
return ( ( ctxt == NULL ) ? NULL : ctxt->encoding );
|
return ( ( ctxt == NULL ) ? NULL : ctxt->encoding );
|
||||||
}
|
}
|
||||||
@@ -1661,7 +1661,7 @@ xmlNanoHTTPEncoding( void * ctx ) {
|
|||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
xmlNanoHTTPMimeType( void * ctx ) {
|
xmlNanoHTTPMimeType( void * ctx ) {
|
||||||
xmlNanoHTTPCtxtPtr ctxt = ctx;
|
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr)ctx;
|
||||||
|
|
||||||
return ( ( ctxt == NULL ) ? NULL : ctxt->mimeType );
|
return ( ( ctxt == NULL ) ? NULL : ctxt->mimeType );
|
||||||
}
|
}
|
||||||
@@ -1680,7 +1680,7 @@ xmlNanoHTTPMimeType( void * ctx ) {
|
|||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
|
xmlNanoHTTPFetchContent( void * ctx, char ** ptr, int * len ) {
|
||||||
xmlNanoHTTPCtxtPtr ctxt = ctx;
|
xmlNanoHTTPCtxtPtr ctxt = (xmlNanoHTTPCtxtPtr)ctx;
|
||||||
|
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
int cur_lgth;
|
int cur_lgth;
|
||||||
|
@@ -7,7 +7,11 @@
|
|||||||
#include <libxml/threads.h>
|
#include <libxml/threads.h>
|
||||||
#include <libxml/parser.h>
|
#include <libxml/parser.h>
|
||||||
#include <libxml/catalog.h>
|
#include <libxml/catalog.h>
|
||||||
|
#ifdef HAVE_PTHREAD_H
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
#include <OS.h>
|
||||||
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#if !defined(_MSC_VER)
|
#if !defined(_MSC_VER)
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -15,7 +19,11 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#define MAX_ARGC 20
|
#define MAX_ARGC 20
|
||||||
|
#ifdef HAVE_PTHREAD_H
|
||||||
static pthread_t tid[MAX_ARGC];
|
static pthread_t tid[MAX_ARGC];
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
static thread_id tid[MAX_ARGC];
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *catalog = "test/threads/complex.xml";
|
static const char *catalog = "test/threads/complex.xml";
|
||||||
static const char *testfiles[] = {
|
static const char *testfiles[] = {
|
||||||
@@ -83,6 +91,7 @@ thread_specific_data(void *private_data)
|
|||||||
return ((void *) Okay);
|
return ((void *) Okay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREAD_H
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
@@ -125,6 +134,62 @@ main(void)
|
|||||||
xmlMemoryDump();
|
xmlMemoryDump();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
unsigned int i, repeat;
|
||||||
|
unsigned int num_threads = sizeof(testfiles) / sizeof(testfiles[0]);
|
||||||
|
void *results[MAX_ARGC];
|
||||||
|
status_t ret;
|
||||||
|
|
||||||
|
xmlInitParser();
|
||||||
|
printf("Parser initialized\n");
|
||||||
|
for (repeat = 0;repeat < 500;repeat++) {
|
||||||
|
printf("repeat: %d\n",repeat);
|
||||||
|
xmlLoadCatalog(catalog);
|
||||||
|
printf("loaded catalog: %s\n", catalog);
|
||||||
|
for (i = 0; i < num_threads; i++) {
|
||||||
|
results[i] = NULL;
|
||||||
|
tid[i] = (thread_id) -1;
|
||||||
|
}
|
||||||
|
printf("cleaned threads\n");
|
||||||
|
for (i = 0; i < num_threads; i++) {
|
||||||
|
tid[i] = spawn_thread(thread_specific_data, "xmlTestThread", B_NORMAL_PRIORITY, (void *) testfiles[i]);
|
||||||
|
if (tid[i] < B_OK) {
|
||||||
|
perror("beos_thread_create");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
printf("beos_thread_create %d -> %d\n", i, tid[i]);
|
||||||
|
}
|
||||||
|
for (i = 0; i < num_threads; i++) {
|
||||||
|
ret = wait_for_thread(tid[i], &results[i]);
|
||||||
|
printf("beos_thread_wait %d -> %d\n", i, ret);
|
||||||
|
if (ret != B_OK) {
|
||||||
|
perror("beos_thread_wait");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlCatalogCleanup();
|
||||||
|
ret = B_OK;
|
||||||
|
for (i = 0; i < num_threads; i++)
|
||||||
|
if (results[i] != (void *) Okay) {
|
||||||
|
printf("Thread %d handling %s failed\n", i, testfiles[i]);
|
||||||
|
ret = B_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
xmlCleanupParser();
|
||||||
|
xmlMemoryDump();
|
||||||
|
|
||||||
|
if (ret == B_OK)
|
||||||
|
printf("testThread : BeOS : SUCCESS!\n");
|
||||||
|
else
|
||||||
|
printf("testThread : BeOS : FAILED!\n");
|
||||||
|
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
#endif /* pthreads or BeOS threads */
|
||||||
|
|
||||||
#else /* !LIBXML_THREADS_ENABLED */
|
#else /* !LIBXML_THREADS_ENABLED */
|
||||||
int
|
int
|
||||||
|
99
threads.c
99
threads.c
@@ -35,6 +35,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BEOS_THREADS
|
||||||
|
#include <OS.h>
|
||||||
|
#include <TLS.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SOLARIS)
|
#if defined(SOLARIS)
|
||||||
#include <note.h>
|
#include <note.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -55,6 +60,8 @@ struct _xmlMutex {
|
|||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
HANDLE mutex;
|
HANDLE mutex;
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
sem_id sem;
|
||||||
#else
|
#else
|
||||||
int empty;
|
int empty;
|
||||||
#endif
|
#endif
|
||||||
@@ -73,6 +80,10 @@ struct _xmlRMutex {
|
|||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
CRITICAL_SECTION cs;
|
CRITICAL_SECTION cs;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
xmlMutexPtr lock;
|
||||||
|
thread_id tid;
|
||||||
|
int32 count;
|
||||||
#else
|
#else
|
||||||
int empty;
|
int empty;
|
||||||
#endif
|
#endif
|
||||||
@@ -96,7 +107,12 @@ static DWORD globalkey = TLS_OUT_OF_INDEXES;
|
|||||||
#endif /* HAVE_COMPILER_TLS */
|
#endif /* HAVE_COMPILER_TLS */
|
||||||
static DWORD mainthread;
|
static DWORD mainthread;
|
||||||
static int run_once_init = 1;
|
static int run_once_init = 1;
|
||||||
#endif /* HAVE_WIN32_THREADS */
|
/* endif HAVE_WIN32_THREADS */
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
int32 globalkey = 0;
|
||||||
|
thread_id mainthread = 0;
|
||||||
|
int32 run_once_init = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static xmlRMutexPtr xmlLibraryLock = NULL;
|
static xmlRMutexPtr xmlLibraryLock = NULL;
|
||||||
#ifdef LIBXML_THREAD_ENABLED
|
#ifdef LIBXML_THREAD_ENABLED
|
||||||
@@ -122,6 +138,11 @@ xmlNewMutex(void)
|
|||||||
pthread_mutex_init(&tok->lock, NULL);
|
pthread_mutex_init(&tok->lock, NULL);
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
tok->mutex = CreateMutex(NULL, FALSE, NULL);
|
tok->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
if ((tok->sem = create_sem(1, "xmlMutex")) < B_OK) {
|
||||||
|
free(tok);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return (tok);
|
return (tok);
|
||||||
}
|
}
|
||||||
@@ -142,6 +163,8 @@ xmlFreeMutex(xmlMutexPtr tok)
|
|||||||
pthread_mutex_destroy(&tok->lock);
|
pthread_mutex_destroy(&tok->lock);
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
CloseHandle(tok->mutex);
|
CloseHandle(tok->mutex);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
delete_sem(tok->sem);
|
||||||
#endif
|
#endif
|
||||||
free(tok);
|
free(tok);
|
||||||
}
|
}
|
||||||
@@ -161,6 +184,13 @@ xmlMutexLock(xmlMutexPtr tok)
|
|||||||
pthread_mutex_lock(&tok->lock);
|
pthread_mutex_lock(&tok->lock);
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
WaitForSingleObject(tok->mutex, INFINITE);
|
WaitForSingleObject(tok->mutex, INFINITE);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
if (acquire_sem(tok->sem) != B_NO_ERROR) {
|
||||||
|
#ifdef DEBUG_THREADS
|
||||||
|
xmlGenericError(xmlGenericErrorContext, "xmlMutexLock():BeOS:Couldn't aquire semaphore\n");
|
||||||
|
exit();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -180,6 +210,8 @@ xmlMutexUnlock(xmlMutexPtr tok)
|
|||||||
pthread_mutex_unlock(&tok->lock);
|
pthread_mutex_unlock(&tok->lock);
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
ReleaseMutex(tok->mutex);
|
ReleaseMutex(tok->mutex);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
release_sem(tok->sem);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +240,13 @@ xmlNewRMutex(void)
|
|||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
InitializeCriticalSection(&tok->cs);
|
InitializeCriticalSection(&tok->cs);
|
||||||
tok->count = 0;
|
tok->count = 0;
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
if ((tok->lock = xmlNewMutex()) == NULL) {
|
||||||
|
free(tok);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
tok->count = 0;
|
||||||
|
tok->tid = 0;
|
||||||
#endif
|
#endif
|
||||||
return (tok);
|
return (tok);
|
||||||
}
|
}
|
||||||
@@ -226,6 +265,8 @@ xmlFreeRMutex(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
|
|||||||
pthread_mutex_destroy(&tok->lock);
|
pthread_mutex_destroy(&tok->lock);
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
DeleteCriticalSection(&tok->cs);
|
DeleteCriticalSection(&tok->cs);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
xmlFreeMutex(tok->lock);
|
||||||
#endif
|
#endif
|
||||||
free(tok);
|
free(tok);
|
||||||
}
|
}
|
||||||
@@ -261,6 +302,15 @@ xmlRMutexLock(xmlRMutexPtr tok)
|
|||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
EnterCriticalSection(&tok->cs);
|
EnterCriticalSection(&tok->cs);
|
||||||
++tok->count;
|
++tok->count;
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
if (tok->tid == find_thread(NULL)) {
|
||||||
|
tok->count++;
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
xmlMutexLock(tok->lock);
|
||||||
|
tok->tid = find_thread(NULL);
|
||||||
|
tok->count = 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -287,6 +337,15 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED)
|
|||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
if (!--tok->count)
|
if (!--tok->count)
|
||||||
LeaveCriticalSection(&tok->cs);
|
LeaveCriticalSection(&tok->cs);
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
if (tok->tid == find_thread(NULL)) {
|
||||||
|
tok->count--;
|
||||||
|
if (tok->count == 0) {
|
||||||
|
tok->tid = 0;
|
||||||
|
xmlMutexUnlock(tok->lock);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,6 +428,15 @@ static CRITICAL_SECTION cleanup_helpers_cs;
|
|||||||
#endif /* HAVE_COMPILER_TLS */
|
#endif /* HAVE_COMPILER_TLS */
|
||||||
#endif /* HAVE_WIN32_THREADS */
|
#endif /* HAVE_WIN32_THREADS */
|
||||||
|
|
||||||
|
#if defined HAVE_BEOS_THREADS
|
||||||
|
void xmlGlobalStateCleanup(void *data)
|
||||||
|
{
|
||||||
|
void *globalval = tls_get(globalkey);
|
||||||
|
if (globalval != NULL)
|
||||||
|
xmlFreeGlobalState(globalval);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* xmlGetGlobalState:
|
* xmlGetGlobalState:
|
||||||
*
|
*
|
||||||
@@ -438,6 +506,20 @@ xmlGetGlobalState(void)
|
|||||||
}
|
}
|
||||||
return (globalval);
|
return (globalval);
|
||||||
#endif /* HAVE_COMPILER_TLS */
|
#endif /* HAVE_COMPILER_TLS */
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
xmlGlobalState *globalval;
|
||||||
|
|
||||||
|
xmlOnceInit();
|
||||||
|
|
||||||
|
if ((globalval = (xmlGlobalState *)
|
||||||
|
tls_get(globalkey)) == NULL) {
|
||||||
|
xmlGlobalState *tsd = xmlNewGlobalState();
|
||||||
|
|
||||||
|
tls_set(globalkey, tsd);
|
||||||
|
on_exit_thread(xmlGlobalStateCleanup, NULL);
|
||||||
|
return (tsd);
|
||||||
|
}
|
||||||
|
return (globalval);
|
||||||
#else
|
#else
|
||||||
return(NULL);
|
return(NULL);
|
||||||
#endif
|
#endif
|
||||||
@@ -463,6 +545,8 @@ xmlGetThreadId(void)
|
|||||||
return((int) pthread_self());
|
return((int) pthread_self());
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
return GetCurrentThreadId();
|
return GetCurrentThreadId();
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
return find_thread(NULL);
|
||||||
#else
|
#else
|
||||||
return((int) 0);
|
return((int) 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -485,6 +569,8 @@ xmlIsMainThread(void)
|
|||||||
run_once_init = 0;
|
run_once_init = 0;
|
||||||
xmlOnceInit ();
|
xmlOnceInit ();
|
||||||
}
|
}
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
xmlOnceInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_THREADS
|
#ifdef DEBUG_THREADS
|
||||||
@@ -494,6 +580,8 @@ xmlIsMainThread(void)
|
|||||||
return(mainthread == pthread_self());
|
return(mainthread == pthread_self());
|
||||||
#elif defined HAVE_WIN32_THREADS
|
#elif defined HAVE_WIN32_THREADS
|
||||||
return(mainthread == GetCurrentThreadId ());
|
return(mainthread == GetCurrentThreadId ());
|
||||||
|
#elif defined HAVE_BEOS_THREADS
|
||||||
|
return(mainthread == find_thread(NULL));
|
||||||
#else
|
#else
|
||||||
return(1);
|
return(1);
|
||||||
#endif
|
#endif
|
||||||
@@ -601,6 +689,15 @@ xmlOnceInit(void) {
|
|||||||
#endif
|
#endif
|
||||||
mainthread = GetCurrentThreadId();
|
mainthread = GetCurrentThreadId();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_BEOS_THREADS
|
||||||
|
if (atomic_add(&run_once_init, 1) == 0) {
|
||||||
|
globalkey = tls_allocate();
|
||||||
|
tls_set(globalkey, NULL);
|
||||||
|
mainthread = find_thread(NULL);
|
||||||
|
} else
|
||||||
|
atomic_add(&run_once_init, -1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user