Re: Interesting Thread Gotcha

2008-01-18 Thread Hendrik van Rooyen
"Dan" wrote: > Would it be possible to have pychecker (or some such) warn that there > is an insufficient parameter count to start_new_thread? I guess that > would require knowing the type of thread. . . I think this is the hub of the thing - its not only start_new_thread, but the way that par

Re: Interesting Thread Gotcha

2008-01-17 Thread Peter Otten
Hendrik van Rooyen wrote: > "Duncan Booth" wrote: > >> Given that the start_new_thread function never actually got called, what >> code exactly do you expect to complain about the absence of a tuple? > > I don't understand this assertion. > > I thought that start_new_thread was called with a

Re: Interesting Thread Gotcha

2008-01-17 Thread Hendrik van Rooyen
"Diez B. Roggisch" wrote: > Hendrik van Rooyen wrote: > > It would have been nice, however, to have gotten something like: > > > > TypeError - This routine needs a tuple. > > > > instead of the silent in line calling of the routine in question, > > while failing actually to start a new thread. >

Re: Interesting Thread Gotcha

2008-01-17 Thread Peter Otten
Hendrik van Rooyen wrote: > "Bjoern Schliessmann" wrote: > > Hendrik van Rooyen wrote: >> Absolutely! - well spotted! > > This is no threading problem at all; not even a syntax problem. If > you don't know exactly what start_new_thread and kbd_driver > functions do it's impossible to tell if yo

Re: Interesting Thread Gotcha

2008-01-17 Thread Hendrik van Rooyen
"Duncan Booth" wrote: > Given that the start_new_thread function never actually got called, what > code exactly do you expect to complain about the absence of a tuple? I don't understand this assertion. I thought that start_new_thread was called with a missing comma in its argument list, whic

Re: Interesting Thread Gotcha

2008-01-17 Thread Hendrik van Rooyen
"Bjoern Schliessmann" wrote: Hendrik van Rooyen wrote: > Absolutely! - well spotted! This is no threading problem at all; not even a syntax problem. If you don't know exactly what start_new_thread and kbd_driver functions do it's impossible to tell if your code does what is intended. > It would

Re: Interesting Thread Gotcha

2008-01-17 Thread Sion Arrowsmith
Diez B. Roggisch <[EMAIL PROTECTED]> wrote: >Of course start_new_thread could throw an error if it got nothing callable >as first argument. No idea why it doesn't. It does: >>> thread.start_new_thread(None, None) Traceback (most recent call last): File "", line 1, in ? TypeError: first arg must

Re: Interesting Thread Gotcha

2008-01-16 Thread Diez B. Roggisch
Dan schrieb: > On Jan 16, 1:33 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Dan schrieb: >> >> >> >>> On Jan 16, 11:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: Hendrik van Rooyen wrote: > "Dan" wrote: > keyboard_thread = thread.start_new_thread(kbd_driver (port_q,

Re: Interesting Thread Gotcha

2008-01-16 Thread Dan
On Jan 16, 1:33 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Dan schrieb: > > > > > On Jan 16, 11:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > >> Hendrik van Rooyen wrote: > >>> "Dan" wrote: > >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > Need

Re: Interesting Thread Gotcha

2008-01-16 Thread Diez B. Roggisch
Dan schrieb: > On Jan 16, 11:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Hendrik van Rooyen wrote: >>> "Dan" wrote: >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) Needs to be >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)

Re: Interesting Thread Gotcha

2008-01-16 Thread Dan
On Jan 16, 11:06 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > Hendrik van Rooyen wrote: > > "Dan" wrote: > > >> >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > > >> Needs to be > >> >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)) > > >> C

Re: Interesting Thread Gotcha

2008-01-16 Thread Diez B. Roggisch
Hendrik van Rooyen wrote: > "Dan" wrote: > > >> >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) >> >> Needs to be >> >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)) >> >> Commas are important! >> >> -Dan > > Absolutely! - well spotted! > >

Re: Interesting Thread Gotcha

2008-01-16 Thread Bjoern Schliessmann
Hendrik van Rooyen wrote: > Absolutely! - well spotted! This is no threading problem at all; not even a syntax problem. If you don't know exactly what start_new_thread and kbd_driver functions do it's impossible to tell if your code does what is intended. > It would have been nice, however, to ha

Re: Interesting Thread Gotcha

2008-01-16 Thread Duncan Booth
"Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > It would have been nice, however, to have gotten something like: > > TypeError - This routine needs a tuple. > > instead of the silent in line calling of the routine in question, > while failing actually to start a new thread. Given that the sta

Re: Interesting Thread Gotcha

2008-01-15 Thread Hendrik van Rooyen
"Dan" wrote: > >>> keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > > Needs to be > >>> keyboard_thread = thread.start_new_thread(kbd_driver, (port_q,kbd_q)) > > Commas are important! > > -Dan Absolutely! - well spotted! As the first correct respondent, you win the fre

Re: Interesting Thread Gotcha

2008-01-15 Thread Dan
On Jan 15, 10:07 am, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > I thought I would share this nasty little gotcha with the group. > > Consider the following code fragment: > > > print 'starting kbd thread' > keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) > print 'starti

Interesting Thread Gotcha

2008-01-15 Thread Hendrik van Rooyen
I thought I would share this nasty little gotcha with the group. Consider the following code fragment: print 'starting kbd thread' keyboard_thread = thread.start_new_thread(kbd_driver (port_q,kbd_q)) print 'starting main loop' error = Mainloop(s,port_q,active_q_list) It produces, as output, t