Thom Nichols

Thom

Technology is evolution outside the gene pool

Articles tagged with 'concurrency'

Use Python's threading.Event for interruptable sleep

As I've mentioned before, python's lack of a Thread.interrupt() method makes writing lively concurrent programs sometimes difficult.  One of the most common scenarios is when you want to sleep() for a period of time.  Yes, sometimes polling is the answer.  There are times when you really want to say "wait for some period of time..."   Except what you almost always mean is "wait for some ...

Python Concurrency using a State Machine

I've been doing steadily heavier Python development, lately running into some concurrency programming problems.  I never thought I'd say this, but Python's concurrency APIs look java.util.concurrent look light-years ahead.  Some of Python's libraries seem designed after the Java equivalents (see threading.Thread and threading.Condition) but there's still definitely a gap. 

One notable omission is a Thread.interrupt() call.  Of course ...