Add syntax for trylock
Submitted by Evan Nemerson
Link to original bug (#632830)
Description
It would be nice if Vala had a syntax for trylock similar to what already exists for lock, but with a way to execute a block if the lock could not be acquired. Something like
trylock ( this.foo ) {
// do something
} else {
// do something else
}
It might also be enough to extend the current lock syntax to allow for a lock...else
syntax (if an else block is present it would just use g_static_rec_mutex_trylock
instead of g_static_rec_mutex_lock
).
Edited by Rico Tzschichholz