Tcl package Thread source code

Ticket Change Details
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2018 Conference, Houston/TX, US, Oct 15-19
Send your abstracts to tclconference@googlegroups.com
or submit via the online form by Aug 20.
Overview

Artifact ID: 29ce06d945ad9aa7e2b023f401063667c0999f1744c87b979cc01dea3ed46851
Ticket: b5709ea9060d17f58ba48110351c964b3408e362
[::thread::send -async] posting order not respected when sending to current thread
User & Date: adrianmedranocalvo 2018-08-10 10:37:55
Changes

  1. Change icomment to:

    Hello,

    Implemented the suggested change, please see patch below. Tests pass:

    ~~~ Only running tests that match: * Skipping test files that match: l.*.test Only sourcing test files that match: *.test Tests began at Fri Aug 10 11:57:28 CEST 2018 Thread 2.8.0 Mainthread id is tid0x7fff8e159380 thread.test tkt-84be1b5a73.test

    tpool.test tsv.test ttrace.test

    Tests ended at Fri Aug 10 11:57:43 CEST 2018 all.tcl: Total 136 Passed 120 Skipped 16 Failed 0 Sourced 0 Test Files. Number of tests skipped for each constraint:

    1. have_gdbm
    2. have_lmdb ~~~

    ~~~ diff --git c/src/tcl8.6.6/pkgs/thread2.8.0/generic/threadCmd.c i/src/tcl8.6.6/pkgs/thread2.8.0/generic/threadCmd.c index 9744230c3..b9af96475 100644 --- c/src/tcl8.6.6/pkgs/thread2.8.0/generic/threadCmd.c +++ i/src/tcl8.6.6/pkgs/thread2.8.0/generic/threadCmd.c @@ -343,9 +343,6 @@ ThreadErrorProc(Tcl_Interp *interp); static void ThreadFreeProc(ClientData clientData);

    -static void -ThreadIdleProc(ClientData clientData); - static void ThreadExitProc(ClientData clientData);

    @@ -2697,21 +2694,13 @@ ThreadSend(interp, thrId, send, clbk, flags) }

    /* - * Short circuit sends to ourself. + * Short circuit synchronous sends to ourself. */ - - if (thrId == Tcl_GetCurrentThread()) { + if (thrId == Tcl_GetCurrentThread() && (flags & THREAD_SEND_WAIT)) { Tcl_MutexUnlock(&threadMutex); - if ((flags & THREAD_SEND_WAIT)) { - int code = (*send->execProc)(interp, (ClientData)send); - ThreadFreeProc((ClientData)send); - return code; - } else { - send->interp = interp; - Tcl_Preserve((ClientData)send->interp); - Tcl_DoWhenIdle((Tcl_IdleProc*)ThreadIdleProc, (ClientData)send); - return TCL_OK; - } + int code = (*send->execProc)(interp, (ClientData)send); + ThreadFreeProc((ClientData)send); + return code; }
    /* @@ -3462,34 +3451,6 @@ ThreadSetOption(interp, thrId, option, value) return TCL_OK; }

    -/* - *---------------------------------------------------------------------- - * - * ThreadIdleProc -- - * - * Results: - * - * Side effects. - * - *---------------------------------------------------------------------- - */ - -static void -ThreadIdleProc(clientData) - ClientData clientData; -{ - int ret; - ThreadSendData *sendPtr = (ThreadSendData*)clientData; - - ret = (*sendPtr->execProc)(sendPtr->interp, (ClientData)sendPtr); - if (ret != TCL_OK) { - ThreadErrorProc(sendPtr->interp); - } - - Tcl_Release((ClientData)sendPtr->interp); - ThreadFreeProc(clientData); -} - /* *---------------------------------------------------------------------- * ~~~

  2. Change login to "adrianmedranocalvo"
  3. Change mimetype to "text/plain"
  4. Change username to "support@prs.de"