Locking and try/finally
Daniel Dittmar
daniel.dittmar at sap.com
Wed Dec 4 05:56:22 EST 2002
More information about the Python-list mailing list
Wed Dec 4 05:56:22 EST 2002
- Previous message (by thread): function prototype checking package?
- Next message (by thread): Locking and try/finally
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Duncan Grisby wrote: > One way to make this kind of thing cleaner is to make locking part of > the language syntax. Modula-3, one of the inspirations of Python, did > things like this... (the syntax is probably wrong, but you get the > idea) > > PROCEDURE critical_function(self: T) = > BEGIN > LOCK self.mu DO > (* Manipulate data... *) > END; > END; > > The compiler turned such statements into the equivalent acquire / > release pair using TRY..FINALLY. If Python had Smalltalk like blocks instead of list comprehension, then one could write self.mutex.do ([ ... code running in critical section ...]) And it would be possible to do the same for all ressources that have to be released in a timely manner. Daniel
- Previous message (by thread): function prototype checking package?
- Next message (by thread): Locking and try/finally
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list