Top | ![]() |
![]() |
![]() |
![]() |
GdaLockable is implemented by GdaConnection, GdaHolder, GdaServerProvider, GdaSqlParser, GdaVconnectionDataModel, GdaVconnectionHub, GdaVirtualConnection, GdaVirtualProvider, GdaVproviderDataModel and GdaVproviderHub.
This interface is implemented by objects which are thread safe (ie. can be used by several threads at
the same time). Before using an object from a thread, one has to call gda_lockable_lock()
or
gda_lockable_trylock()
and call gda_lockable_unlock()
when the object is not used anymore.
void
gda_lockable_lock (GdaLockable *lockable
);
Locks lockable
. If it is already locked by another thread, the current thread will block until it is unlocked
by the other thread.
Note: unlike g_mutex_lock()
, this method recursive, which means a thread can lock lockable
several times
(and has to unlock it as many times to actually unlock it).
gboolean
gda_lockable_trylock (GdaLockable *lockable
);
Tries to lock lockable
. If it is already locked by another thread, then it immediately returns FALSE, otherwise
it locks lockable
.
Note: unlike g_mutex_lock()
, this method recursive, which means a thread can lock lockable
several times
(and has to unlock it as many times to actually unlock it).
void
gda_lockable_unlock (GdaLockable *lockable
);
Unlocks lockable
. This method should not be called if the current does not already holds a lock on lockable
(having
used gda_lockable_lock()
or gda_lockable_trylock()
).