Gda.Lockable

g GObject.GInterface GObject.GInterface Gda.Lockable Gda.Lockable GObject.GInterface->Gda.Lockable

Implementations:
 Gda.Connection, Gda.Holder, Gda.SqlParser

Methods

  lock ()
  trylock ()
  unlock ()

Virtual Methods

  do_i_lock ()
  do_i_trylock ()
  do_i_unlock ()

Properties

None

Signals

None

Fields

None

Class Details

class Gda.Lockable
Bases:GObject.GInterface
Structure:Gda.LockableIface
lock()

Locks self. If it is already locked by another thread, the current thread will block until it is unlocked by the other thread.

This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.

Note: unlike GLib.Mutex.lock(), this method recursive, which means a thread can lock self several times (and has to unlock it as many times to actually unlock it).

trylock()
Returns:True if the object has successfully been locked.
Return type:bool

Tries to lock self. If it is already locked by another thread, then it immediately returns False, otherwise it locks self.

This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.

Note: unlike GLib.Mutex.lock(), this method recursive, which means a thread can lock self several times (and has to unlock it as many times to actually unlock it).

unlock()

Unlocks self. This method should not be called if the current does not already holds a lock on self (having used Gda.Lockable.lock() or Gda.Lockable.trylock()).

This function can be used even if g_thread_init() has not yet been called, and, in that case, will do nothing.

do_i_lock() virtual
do_i_trylock() virtual
Return type:bool
do_i_unlock() virtual