diff options
Diffstat (limited to 'mac')
-rw-r--r-- | mac/tclMacSock.c | 91 |
1 files changed, 90 insertions, 1 deletions
diff --git a/mac/tclMacSock.c b/mac/tclMacSock.c index f272f87..32df000 100644 --- a/mac/tclMacSock.c +++ b/mac/tclMacSock.c @@ -8,7 +8,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclMacSock.c,v 1.14 2002/04/08 09:03:17 das Exp $ + * RCS: @(#) $Id: tclMacSock.c,v 1.15 2003/04/22 23:20:43 andreas_kupries Exp $ */ #include "tclInt.h" @@ -2790,3 +2790,92 @@ pascal void NotifyRoutine ( localIcmpMsg = *icmpMsg; } + +/* + *---------------------------------------------------------------------- + * + * TclpCutSockChannel -- + * + * Remove any thread local refs to this channel. See + * Tcl_CutChannel for more info. + * + * Results: + * None. + * + * Side effects: + * Changes thread local list of valid channels. + * + *---------------------------------------------------------------------- + */ + +void +TclpCutSockChannel(chan) + Tcl_Channel chan; +{ + ThreadSpecificData *tsdPtr; + TcpState *infoPtr; + TcpState **nextPtrPtr; + int removed = 0; + + if (Tcl_GetChannelType(chan) != &tcpChannelType) + return; + + tsdPtr = TCL_TSD_INIT(&dataKey); + infoPtr = (TcpState *) Tcl_GetChannelInstanceData (chan); + + for (nextPtrPtr = &(tsdPtr->socketList); (*nextPtrPtr) != NULL; + nextPtrPtr = &((*nextPtrPtr)->nextPtr)) { + if ((*nextPtrPtr) == infoPtr) { + (*nextPtrPtr) = infoPtr->nextPtr; + removed = 1; + break; + } + } + + /* + * This could happen if the channel was created in one thread + * and then moved to another without updating the thread + * local data in each thread. + */ + + if (!removed) + panic("file info ptr not on thread channel list"); + return; +} + +/* + *---------------------------------------------------------------------- + * + * TclpSpliceSockChannel -- + * + * Insert thread local ref for this channel. + * Tcl_SpliceChannel for more info. + * + * Results: + * None. + * + * Side effects: + * Changes thread local list of valid channels. + * + *---------------------------------------------------------------------- + */ + +void +TclpSpliceSockChannel(chan) + Tcl_Channel chan; +{ + ThreadSpecificData *tsdPtr; + TcpState *infoPtr; + + if (Tcl_GetChannelType(chan) != &tcpChannelType) + return; + + InitSockets (); + + tsdPtr = TCL_TSD_INIT(&dataKey); + infoPtr = (TcpState *) Tcl_GetChannelInstanceData (chan); + + infoPtr->nextPtr = tsdPtr->socketList; + tsdPtr->socketList = infoPtr; +} + |