g_object_set / g_object_get and multi thread program
- From: "Tomasz Jankowski" <tomcioj gmail com>
- To: gtk-app-devel-list gnome org
- Subject: g_object_set / g_object_get and multi thread program
- Date: Mon, 2 Jul 2007 10:50:03 +0200
Hello!
Are functions above thread safe? Or maybe I need to provide some protection
system on my own? If I do, can you tell me if something like that will be a
good idea:
static void
socket_set_property (GObject *object, guint prop_id, const GValue *value,
GParamSpec *pspec)
{
g_return_if_fail (IS_SOCKET (object));
SocketPrivate *priv_data = SOCKET_PRIVATE (SOCKET (object));
g_static_rw_lock_writer_unlock (priv_data->rw_mutex);
switch (prop_id) {
/*...*/
}
g_static_rw_lock_writer_lock (priv_data->rw_mutex);
}
static void
socket_get_property (GObject *object, guint prop_id, GValue *value,
GParamSpec *pspec)
{
g_return_if_fail (IS_SOCKET (object));
SocketPrivate *priv_data = SOCKET_PRIVATE (SOCKET (object));
g_static_rw_lock_reader_unlock (priv_data->rw_mutex);
switch (prop_id) {
/*...*/
}
g_static_rw_lock_reader_lock (priv_data->rw_mutex);
}
--
Cya!
Tom
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]