teepark / greenhouse

non-blocking IO with coroutines to mimic blocking IO with threads
BSD 3-Clause "New" or "Revised" License
35 stars 5 forks source link

threading.current_thread().ident emulation doesn't work. #8

Closed dsully closed 12 years ago

dsully commented 12 years ago

Looks like threading.current_thread() returns a greenlet, but it doesn't have an .ident attribute.

print id(threading.current_thread()) => 4345707088 print threading.current_thread().ident => None

teepark commented 12 years ago

fixed this over the course of a couple of commits, but should be good as of efe28aae4

FWIW it already worked if you just straight patched threading and then used the threading module as before. this issue was only the case when you use threading.current_thread in a greenlet that wasn't created via the patched threading module (and in that case you still won't have full functionality -- there's just no good way to implement join without opt-in from the time the greenlet is created).

thanks, --travis

dsully commented 12 years ago

Great, I'll be able to test it later on today. Makes complete sense with the join limitation.

I ran into this because I was using greenhouse.schedule() and then attempting to get the greenlet id, FWIW.