diff options
| author | apnadkarni <apnmbx-wits@yahoo.com> | 2025-01-16 17:07:38 (GMT) |
|---|---|---|
| committer | apnadkarni <apnmbx-wits@yahoo.com> | 2025-01-16 17:07:38 (GMT) |
| commit | de5d05f3878fa1d904a7bbb0b3cbb726b0613c31 (patch) | |
| tree | 3eb921e77b17470e7f5424481944264bded7d45c | |
| parent | a8b500647313c3164a4bf51a7024f75d3a0d3de9 (diff) | |
| download | tcl-core-apn-tip-709.zip tcl-core-apn-tip-709.tar.gz tcl-core-apn-tip-709.tar.bz2 | |
Add one more test for _tls_indexcore-apn-tip-709
| -rw-r--r-- | tests/memorymodule.test | 6 | ||||
| -rw-r--r-- | win/dltest/memorymoduletest.c | 21 |
2 files changed, 26 insertions, 1 deletions
diff --git a/tests/memorymodule.test b/tests/memorymodule.test index 2624fd6..ec065b8 100644 --- a/tests/memorymodule.test +++ b/tests/memorymodule.test @@ -54,6 +54,12 @@ test memorymodule-3.0 {Multiple DLL's} -constraints {memorymoduletest} -body { lappend result [memorymoduletest2::ThreadVar]; # Check second module } -result {15 15 16} +test memorymodule-3.1 {Multiple DLL's} -constraints {memorymoduletest} -body { + package require memorymoduletest2 + package require memorymoduletest + # The two _tls_index should NOT be the same + expr {[memorymoduletest::GetTlsIndex] == [memorymoduletest2::GetTlsIndex]} +} -result 0 # cleanup diff --git a/win/dltest/memorymoduletest.c b/win/dltest/memorymoduletest.c index be487b2..3c3df4a 100644 --- a/win/dltest/memorymoduletest.c +++ b/win/dltest/memorymoduletest.c @@ -183,6 +183,25 @@ Mmt_ThreadVar( return TCL_OK; } +static int +Mmt_GetTlsIndex( + void *dummy, /* Not used. */ + Tcl_Interp *interp, /* Current interpreter. */ + int objc, /* Number of arguments. */ + Tcl_Obj *const objv[]) /* Argument strings. */ +{ + extern int _tls_index; + (void)dummy; + + if (objc > 1) { + Tcl_WrongNumArgs(interp, 1, objv, ""); + return TCL_ERROR; + } + Tcl_SetObjResult(interp, Tcl_NewIntObj(_tls_index)); + return TCL_OK; +} + + /* *---------------------------------------------------------------------- * @@ -206,7 +225,6 @@ INIT_NAME ( * made available. */ { int code; - threadVar = hModule; if (Tcl_InitStubs(interp, "8.7-", 0) == NULL) { /* Tcl 8.6 doesn't have Tcl_DStringToObj() */ @@ -220,5 +238,6 @@ INIT_NAME ( Tcl_CreateObjCommand(interp, PACKAGE_NS "::GetModuleFileNameW", Mmt_ModuleFileNameWCmd, NULL, NULL); Tcl_CreateObjCommand(interp, PACKAGE_NS "::ThreadAttachCalled", Mmt_ThreadAttachCalled, NULL, NULL); Tcl_CreateObjCommand(interp, PACKAGE_NS "::ThreadVar", Mmt_ThreadVar, NULL, NULL); + Tcl_CreateObjCommand(interp, PACKAGE_NS "::GetTlsIndex", Mmt_GetTlsIndex, NULL, NULL); return TCL_OK; } |
