[Stackless] Stackless Tcl prob (was: Stackless bug/typo)

Christian Tismer tismer at tismer.com
Wed Jun 19 12:44:09 CEST 2002


[Hi Jean-Claude,
I cc'ed to you since I remember you told me of
stack problems with your stackless Tcl prototype.
Can you give us a hint?]

Jeff Senn wrote:
> Jeff Senn <senn at maya.com> writes:
> 
>>>Understand: I am doing something a little wierd with Tk -- I'm running
>>>all of my uthreads in one real thread, and tk.mainloop() in another
>>>real thread (using a Queue to communicate between).

Hmm. What does this mean, because I don't understand how Tk
works?
If I have one thread, and tkinter, and then some mainloop:
The python code then sometimes executes stuff like print
that calls back into tkinter which calls back into Python,
and so on. Variables on the stack have to exist.

Now, if the main loop is in another thread, it is still right
that your uthreads are calling back into tkinter. They
are just not sitting on top of a mainloop in their thread.

There are two or three places where I protected tkinter.
Maybe I missed one, because it sat always in the context
of a mainloop, which already sets the slicing lock.

>>As a followup -- if I rearrange my code (ouch!) so that Tk and my
>>stackless uthreads run in the same thread... then I seem to get no
>>crashes.
>>
>>What does that mean? ... I don't know... :-)

Sounds bad. You are not slicing, just switching, and this is
still crashing, depending on execution order? That would
mean that Tk keeps some hidden references to stack-based
objects in a way I don't understand. Jean-Claude?

> More data:
> 
> I even crash occasionally (usually in "Tk-callback-land" somewhere)
> when slicing is enabled.  So I suspect there is still some _tkinter
> problem lurking somewhere...
> 

Yes, probably I'm missing something that must be protected.
Hint: If you want to track this down, set the slicing
interval to 1. This makes you crash ASAP.

But the inter-thread stuff sounds really weird.

thanks & cheers - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  pager +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/


_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless



More information about the Stackless mailing list