@synchronized dect'r &c.
castironpi at gmail.com
castironpi at gmail.com
Sat Feb 23 16:39:17 EST 2008
Corrections.
Typographical error in the implementation of #1.
def synchronized( func ):
def presynch( *ar, **kwar ):
with _synchlock:
lock= _synchhash.setdefault( func, allocate_lock() )
with lock:
return func( *ar, **kwar )
return presynch
On footnote #4, one might need a vector of jump addresses, one for
each context in which the word might be modified. Yes, this involves
a miniature "many small" design in actual hardware memory, and
definitely opens some doors to faster processing. As such, it may not
be the best "first" structural element in paralell off-loading, but
it's a good one. And yes, it's specialty RAM, for which RAM may not
even be the right place. If a few KB of it is enough, just bump it up
next to the cache, which may make for shorter cycles on the jump-back
later. You probably don't want to be setting the instruction pointer
from a KB's worth of addresses, so there's probably an extra cycle
involved in setting the jump register, halting the IP, and signalling
a jump. Interrupts may be suited too. Does the OS need to provide an
API before a compiler can make use of it?
On #4, the signatures func( self, locks ) vs. func( locks, self ) is
open: just if you sometimes want locks to be the second parameter, and
other times the first, as for non-class-member functions, there will
be two methods, or a parameter to signal the difference.
More information about the Python-list
mailing list