[Vala] lock (this) not available?



I noticed while coding with threads that the statement lock (this) is not available.  valac returns this error:

error: _expression_ is either not a member access or does not denote a lockable member

Is it part of the language spec that only members can be locked and not the "this" object itself?  I can't find documentation either way.

I've also discovered you cannot lock an object externally, a la:

Obj o = new Obj();
lock (o) {
    o.get_value();
}

does not compile, with the same error.  Again, I'm unsure if this is part of the spec.

Since I'm on the subject, if you are able to lock (this), it would be nice if you could lock an object throughout a method's execution, a la Java's synchronized methods:

public lock void atomic_op() {
}

-- Jim



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]