5 #include "mono/io-layer/wapi.h"
7 static pthread_key_t error_key;
8 static pthread_once_t error_key_once=PTHREAD_ONCE_INIT;
10 static void error_init(void)
12 pthread_key_create(&error_key, NULL);
18 * Retrieves the last error that occurred in the calling thread.
20 * Return value: The error code for the last error that happened on
23 guint32 GetLastError(void)
28 pthread_once(&error_key_once, error_init);
29 errptr=pthread_getspecific(error_key);
30 err=GPOINTER_TO_UINT(errptr);
37 * @code: The error code.
39 * Sets the error code in the calling thread.
41 void SetLastError(guint32 code)
43 /* Set the thread-local error code */
44 pthread_once(&error_key_once, error_init);
45 pthread_setspecific(error_key, GUINT_TO_POINTER(code));