Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

thread::create create 2 system threads instead of one

93 views
Skip to first unread message

Олег Н.

unread,
Feb 22, 2024, 4:10:56 AMFeb 22
to
Hi, all.

Can anybody explain why first call of thread::create makes 2 system threads instead of one?

For example, we have t.tcl script:
~$ cat t.tcl
#!/usr/bin/tclsh

package require Thread

puts "stage1"
after 10000
thread::create {thread::wait}

puts "stage2"
after 10000

thread::create {thread::wait}

puts "stage3"
after 10000

We run it. And check system threads on every stage change:
~$ ps -aL | grep t.tcl
8134 8134 pts/2 00:00:00 t.tcl
~$ ps -aL | grep t.tcl
8134 8134 pts/2 00:00:00 t.tcl
8134 8372 pts/2 00:00:00 t.tcl
8134 8373 pts/2 00:00:00 t.tcl
~$ ps -aL | grep t.tcl
8134 8134 pts/2 00:00:00 t.tcl
8134 8372 pts/2 00:00:00 t.tcl
8134 8373 pts/2 00:00:00 t.tcl
8134 8605 pts/2 00:00:00 t.tcl

Harald Oehlmann

unread,
Feb 22, 2024, 4:20:26 AMFeb 22
to
Hi Oleg,
what is your platform? If it is linux, which threadding system was
compiled in (pthreads) (found by the configure script).

Take care,
Harald

Олег Н.

unread,
Feb 22, 2024, 4:25:16 AMFeb 22
to
> Hi Oleg,
> what is your platform? If it is linux, which threadding system was
> compiled in (pthreads) (found by the configure script).

Oops. Forgot to say. I use Linux based os.
% array get tcl_platform
osVersion 5.4.247-my pointerSize 8 byteOrder littleEndian threaded 1 machine x86_64 platform unix pathSeparator : os Linux engine Tcl user lego wordSize 8
~$ ldd `which tclsh` | grep thread
libpthread.so.0 => /lib/libpthread.so.0 (0x00007f7bad070000)

0 new messages