On 30-05-2012 14:54, Thiez wrote:
On Wednesday, 30 May 2012 at 12:43:15 UTC, deadalnix wrote:

It doesn't address most of the drawback cited. Notably the fact that
every object have a monitor field, but most of them will not use it.

That could be solved without abandoning object locks. If locking on all
objects is allowed, objects in TLS could simply omit the monitor field.
Locking would then be performed as:

if (object not in TLS) {
insert expensive locking operation here
}
return

Yes, this would introduce an extra conditional jump whenever a lock is
acquired/released, but the overhead is very small compared to the
relatively expensive lock/unlock operation.

I don't understand how that would work. Where would you store the monitor reference?

--
Alex Rønne Petersen
a...@lycus.org
http://lycus.org

Reply via email to