Killing threads (was Re: Cancel or timeout a long running regular expression)

Ian Kelly ian.g.kelly at gmail.com
Tue Sep 20 00:04:17 CEST 2011


On Mon, Sep 19, 2011 at 12:25 AM, Chris Angelico <rosuav at gmail.com> wrote:
> On Mon, Sep 19, 2011 at 3:41 PM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>> And what if the thread gets killed in the middle of the commit?
>>
>
> Database managers solved this problem years ago. It's not done by
> preventing death until you're done - death can come from someone
> brutally pulling out your power cord. There's no "except
> PowerCordRemoved" to protect you from that!

I'm aware of that.  I'm not saying it's impossible, just that the
example you gave is over-simplified, as writing atomic transactional
logic is a rather complex topic.  There may be an existing Python
library to handle this, but I'm not aware of one.

"PowerCordRemoved" is not relevant here, as that would kill the entire
process, which renders the issue of broken shared data within a
continuing process rather moot.

Cheers,
Ian



More information about the Python-list mailing list