index ed33e897948c24a9452a61f0900f42231b6b1336..e0dad45a565f8acacf40c6c17afd8b6ca28be816 100644 (file)
--- a/src/rrd_thread_safe_nt.c
+++ b/src/rrd_thread_safe_nt.c
/*****************************************************************************
- * RRDtool 1.3.7 Copyright by Tobi Oetiker, 1997-2009
+ * RRDtool 1.3.2 Copyright by Tobi Oetiker, 1997-2008
* This file: Copyright 2003 Peter Stamfest <peter@stamfest.at>
* & Tobias Oetiker
* Distributed under the GPL
* rrd_thread_safe.c Contains routines used when thread safety is required
* for win32
*****************************************************************************
- * $Id: rrd_thread_safe_nt.c 1781 2009-04-07 07:31:53Z oetiker $
+ * $Id$
*************************************************************************** */
#include <windows.h>
/* Once-only initialisation of the key */
-static volatile LONG context_key_once = 0;
+static DWORD context_key_once = 0;
/* Free the thread-specific rrd_context - we might actually use
static void context_init_context(
void)
{
- if (!InterlockedExchange(&context_key_once, 1)) {
+ if (!InterlockedExchange((LONG*)(&context_key_once), 1)) {
context_key = TlsAlloc();
InitializeCriticalSection(&CriticalSection);
atexit(context_destroy_context);
context_init_context();
- ctx = (rrd_context_t*)(TlsGetValue(context_key));
+ ctx = (rrd_context_t*)TlsGetValue(context_key);
if (!ctx) {
ctx = rrd_new_context();
TlsSetValue(context_key, ctx);
return ctx;
}
-#ifdef WIN32
- rrd_context_t *rrd_force_new_context(void)
- {
- rrd_context_t *ctx;
- context_init_context();
+/* this was added by the win32 porters Christof.Wegmann@exitgames.com */
- ctx = rrd_new_context();
- TlsSetValue(context_key, ctx);
+rrd_context_t *rrd_force_new_context(
+ void)
+{
+ rrd_context_t *ctx;
+
+ context_init_context();
+
+ ctx = rrd_new_context();
+ TlsSetValue(context_key, ctx);
+
+ return ctx;
+}
- return ctx;
- }
-#endif
#undef strerror
const char *rrd_strerror(