Menu

#208 Application/interpreter crash when releasing thread

3.3.0
closed-out-of-date
5
2014-09-20
2010-09-17
Googie
No

Hi,

Application crashes in like 5% of cases when the Thread is released from Itcl object destructor, but when call to [thread::release] is moved into Tcl eventloop (by calling [after idle "thread::release $id"] in destructor), then everything works fine.

Detailed description from clt:

At moment 1:
set thread [thread::create {thread::wait}]

At several moments 2:
thread::send -async $thread {some code}

At moment 3:
thread::release $thread

It's possible that "moment 3" occures in the middle of executing "some code" 
in $thread.

Currently it works for me in most cases, but like in 5% of cases the main 
Tcl interpreter crashes with message like:
alloc: invalid block: 0x4000350: 90 4
Interrupted

I tried creating [thread::create] with -preserved option, but it didn't make 
any difference.

Funny thing is, that 'moment 3' was called from destructor of Itcl object, 
but when I moved it to Tcl event (jusing simple [after 100]) the problem 
disappeard.

Discussion

  • Googie

    Googie - 2010-09-17

    Forgot to mention:

    Tcl/Tk 8.5.8 (ActiveTcl),
    OS: Linux Slackware 13.1 (glibc 2.11.1, kernel 2.6.33.4, Xorg 1.7.7)

     
  • Arnulf Wiedemann

    • status: open --> closed-out-of-date
    • Group: --> 3.3.0
     

Log in to post a comment.