Posted to tcl by patthoyts at Thu Jul 31 23:41:52 GMT 2008view pretty

int
TkWinSend_QueueCommand(
    Tcl_ThreadId tid,
    Tcl_Interp *interp,
    Tcl_Obj *cmdPtr)
{
    SendEvent *evPtr;

    TRACE("SendQueueCommand() tid %08x\n", (DWORD)Tcl_GetCurrentThread());

    evPtr = (SendEvent *)ckalloc(sizeof(SendEvent));
    evPtr->header.proc = SendEventProc;
    evPtr->header.nextPtr = NULL;
    evPtr->interp = interp;
    evPtr->magic = 0x53454e44;
    Tcl_Preserve(evPtr->interp);

    evPtr->cmdPtr = cmdPtr;
    if (Tcl_IsShared(cmdPtr)) {
	evPtr->cmdPtr = Tcl_DuplicateObj(cmdPtr);
    }
    Tcl_IncrRefCount(evPtr->cmdPtr);

    Tcl_ThreadQueueEvent(tid, (Tcl_Event *)evPtr, TCL_QUEUE_TAIL);
    Tcl_ThreadAlert(tid);

    return 0;
}