X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_thread_safe_nt.c;h=e8ac2886c883acd1125b8184fce20e1e947f840c;hb=2c16b54029a3f5f08899c15d82c78a3a23d99e94;hp=8277ca48aec21dadcac6d0f95a0bde0efa9347d4;hpb=8d278938aef5adefa2915dd446abc028cc764550;p=rrdtool.git diff --git a/src/rrd_thread_safe_nt.c b/src/rrd_thread_safe_nt.c index 8277ca4..e8ac288 100644 --- a/src/rrd_thread_safe_nt.c +++ b/src/rrd_thread_safe_nt.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.3rc7 Copyright by Tobi Oetiker, 1997-2008 + * RRDtool 1.4.2 Copyright by Tobi Oetiker, 1997-2009 * This file: Copyright 2003 Peter Stamfest * & Tobias Oetiker * Distributed under the GPL @@ -38,7 +38,7 @@ static void context_destroy_context( 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); @@ -51,7 +51,7 @@ rrd_context_t *rrd_get_context( context_init_context(); - ctx = TlsGetValue(context_key); + ctx = (rrd_context_t*)TlsGetValue(context_key); if (!ctx) { ctx = rrd_new_context(); TlsSetValue(context_key, ctx); @@ -59,6 +59,23 @@ rrd_context_t *rrd_get_context( return ctx; } + +/* this was added by the win32 porters Christof.Wegmann@exitgames.com */ + +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; +} + + #undef strerror const char *rrd_strerror( int err)