threads and sleep?

Christopher Subich spam.csubich+block at block.subich.spam.com
Thu Jul 14 19:40:01 CEST 2005


Jp Calderone wrote:
> On 14 Jul 2005 05:10:38 -0700, Paul Rubin 
> <"http://phr.cx"@nospam.invalid> wrote:
> 
>> Andreas Kostyrka <andreas at kostyrka.org> writes:
>>
>>> Basically the current state of art in "threading" programming doesn't
>>> include a safe model. General threading programming is unsafe at the
>>> moment, and there's nothing to do about that. It requires the developer
>>> to carefully add any needed locking by hand.
>>
>>
>> So how does Java do it?  Declaring some objects and functions to be
>> synchronized seems to be enough, I thought.
> 
> 
> Multithreaded Java programs have thread-related bugs in them too.  So it 
> doesn't seem to be enough.  Like Python's model, Java's is mostly about 
> ensuring internal interpreter state doesn't get horribly corrupted.  It 
> doesn't do anything for application-level state.  For example, the 

Hrm... this would suggest the possibility of designing a metaclass, 
perhaps, that would ensure synchronous access to an object.  Perhaps 
"wrap" the class in another, that gets and releases a mutex on any 
external get/set access (except, possibly, for a specified list of 
"asynchronous" data members and methods).

This, of course, wouldn't elminate deadlocks, but that's a problem that 
arises from interaction from multiple objects, rather than within a 
single one.



More information about the Python-list mailing list