diff options
author | georgeps <georgeps> | 2008-05-09 04:58:52 (GMT) |
---|---|---|
committer | georgeps <georgeps> | 2008-05-09 04:58:52 (GMT) |
commit | e782414ad0af468115d69e437d0d70c5895287ff (patch) | |
tree | 2a1b16698533508941b5316630a09d07a0ffac94 /win/tclWinThrd.c | |
parent | 78fea2db721429cce261b5621f85f6f7390ece78 (diff) | |
download | tcl-e782414ad0af468115d69e437d0d70c5895287ff.zip tcl-e782414ad0af468115d69e437d0d70c5895287ff.tar.gz tcl-e782414ad0af468115d69e437d0d70c5895287ff.tar.bz2 |
* generic/tcl.h: Make Tcl_ThreadDataKey a void *.
* generic/tclInt.h: Change around some function names and
add some new per-platform declarations for thread-specific data
functions.
* generic/tclThread.c: Make use of of the new function names
that no longer have a Tclp prefix.
* generic/tclThreadStorage.c: Replace the core thread-specific data
(TSD) mechanism with an array offset solution that eliminates the
hash tables, and only uses one slot of native TSD.
Many thanks to Kevin B. Kenny for his help with this.
* unix/tclUnixThrd.c: Add platform-specific TSD functions for use
by tclThreadStorage.c.
* win/tclWinThrd.c: Add platform-specific TSD functions for use
by tclThreadStorage.c.
Diffstat (limited to 'win/tclWinThrd.c')
-rw-r--r-- | win/tclWinThrd.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/win/tclWinThrd.c b/win/tclWinThrd.c index 11dcd1a..f6732b8 100644 --- a/win/tclWinThrd.c +++ b/win/tclWinThrd.c @@ -5,11 +5,12 @@ * * Copyright (c) 1998 by Sun Microsystems, Inc. * Copyright (c) 1999 by Scriptics Corporation + * Copyright (c) 2008 by George Peter Staplin * * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclWinThrd.c,v 1.44 2008/04/27 22:21:37 dkf Exp $ + * RCS: @(#) $Id: tclWinThrd.c,v 1.45 2008/05/09 04:58:55 georgeps Exp $ */ #include "tclWinInt.h" @@ -854,6 +855,9 @@ TclpFinalizeCondition( } } + + + /* * Additions by AOL for specialized thread memory allocator. */ @@ -954,6 +958,45 @@ TclpFreeAllocCache( } #endif /* USE_THREAD_ALLOC */ + + +void *TclpThreadCreateKey (void) { + DWORD *key; + + key = TclpSysAlloc(sizeof *key, 0); + if (key == NULL) { + Tcl_Panic("unable to allocate thread key!"); + } + + *key = TlsAlloc(); + + return key; +} + +void TclpThreadDeleteKey(void *keyPtr) { + DWORD *key = keyPtr; + + if (!TlsFree(*key)) { + Tcl_Panic("unable to delete key"); + } + + TclpSysFree(keyPtr); +} + +void TclpThreadSetMasterTSD(void *tsdKeyPtr, void *ptr) { + DWORD *key = tsdKeyPtr; + + if (!TlsSetValue(*key, ptr)) { + Tcl_Panic("unable to set master TSD value"); + } +} + +void *TclpThreadGetMasterTSD(void *tsdKeyPtr) { + DWORD *key = tsdKeyPtr; + + return TlsGetValue(*key); +} + #endif /* TCL_THREADS */ /* |