3 ms·
If you tag objects as being either "owned" by a thread or "shared" then you could (in the python implementation) do something like: if (obj.owner == current_
by jbert 14y ago
If you tag objects as being either "owned" by a thread or "shared" then you could (in the python implementation) do something like:
if (obj.owner == current_thread):
# just get in and mess with it
elsif (obj.owner == shared):
# get in and mess with it under a lock
else
throw "not your obj - make this obj shared if you need that"
From a language perspective, you'd just need a way to declare that an object was 'shared'. All other objs would be owned by their creating thread.
- anacrolix 14y agoIt's not that easy.