Fix Windows build
This commit is contained in:
@@ -85,8 +85,8 @@ static HEIMDAL_THREAD_LOCAL struct tls_values values;
|
|||||||
|
|
||||||
#define DEAD_KEY ((void *)8)
|
#define DEAD_KEY ((void *)8)
|
||||||
|
|
||||||
static void
|
void
|
||||||
del_tls_for_thread(void *unused)
|
heim_w32_service_thread_detach(void *unused)
|
||||||
{
|
{
|
||||||
tls_keys *key_defs;
|
tls_keys *key_defs;
|
||||||
void (*dtor)(void*);
|
void (*dtor)(void*);
|
||||||
@@ -124,7 +124,7 @@ pthread_once_t pt_once = PTHREAD_ONCE_INIT;
|
|||||||
static void
|
static void
|
||||||
atexit_del_tls_for_thread(void)
|
atexit_del_tls_for_thread(void)
|
||||||
{
|
{
|
||||||
del_tls_for_thread(NULL);
|
heim_w32_service_thread_detach(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -134,7 +134,7 @@ create_pt_key(void)
|
|||||||
|
|
||||||
/* The main thread may not execute TLS destructors */
|
/* The main thread may not execute TLS destructors */
|
||||||
atexit(atexit_del_tls_for_thread);
|
atexit(atexit_del_tls_for_thread);
|
||||||
ret = pthread_key_create(&pt_key, del_tls_for_thread);
|
ret = pthread_key_create(&pt_key, heim_w32_service_thread_detach);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
err(1, "pthread_key_create() failed");
|
err(1, "pthread_key_create() failed");
|
||||||
}
|
}
|
||||||
@@ -319,30 +319,6 @@ heim_w32_getspecific(HEIM_PRIV_thread_key key)
|
|||||||
return values.values[key];
|
return values.values[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
|
||||||
DWORD fdwReason,
|
|
||||||
LPVOID lpvReserved)
|
|
||||||
{
|
|
||||||
switch (fdwReason) {
|
|
||||||
case DLL_PROCESS_ATTACH:
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
case DLL_THREAD_ATTACH:
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
case DLL_THREAD_DETACH:
|
|
||||||
del_tls_for_thread(NULL);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
#endif /* WIN32 */
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static char dummy;
|
static char dummy;
|
||||||
#endif /* HEIM_WIN32_TLS */
|
#endif /* HEIM_WIN32_TLS */
|
||||||
|
@@ -418,4 +418,14 @@ void _bsearch_file_info(bsearch_file_handle bfh, size_t *page_sz,
|
|||||||
size_t *max_sz, int *blockwise);
|
size_t *max_sz, int *blockwise);
|
||||||
void _bsearch_file_close(bsearch_file_handle *bfh);
|
void _bsearch_file_close(bsearch_file_handle *bfh);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Thread-specific keys
|
||||||
|
*/
|
||||||
|
|
||||||
|
int heim_w32_key_create(unsigned long *, void (*)(void *));
|
||||||
|
int heim_w32_delete_key(unsigned long);
|
||||||
|
int heim_w32_setspecific(unsigned long, void *);
|
||||||
|
void *heim_w32_getspecific(unsigned long);
|
||||||
|
void heim_w32_service_thread_detach(void *);
|
||||||
|
|
||||||
#endif /* HEIM_BASE_H */
|
#endif /* HEIM_BASE_H */
|
||||||
|
@@ -33,7 +33,9 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(HEIM_BASE_MAINTAINER) && !defined(WIN33) && defined(ENABLE_PTHREAD_SUPPORT)
|
#if defined(HEIM_BASE_MAINTAINER) && defined(ENABLE_PTHREAD_SUPPORT)
|
||||||
|
#define HEIM_WIN32_TLS
|
||||||
|
#elif defined(WIN32)
|
||||||
#define HEIM_WIN32_TLS
|
#define HEIM_WIN32_TLS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
#include<windows.h>
|
#include<windows.h>
|
||||||
|
|
||||||
|
extern void heim_w32_service_thread_detach(void *);
|
||||||
|
|
||||||
HINSTANCE _krb5_hInstance = NULL;
|
HINSTANCE _krb5_hInstance = NULL;
|
||||||
|
|
||||||
#if NTDDI_VERSION >= NTDDI_VISTA
|
#if NTDDI_VERSION >= NTDDI_VISTA
|
||||||
@@ -65,6 +67,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
case DLL_THREAD_DETACH:
|
case DLL_THREAD_DETACH:
|
||||||
|
heim_w32_service_thread_detach(NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user