Roberto Perez
2002-12-05 00:04:40 UTC
Hi!
We are working in mozilla plugin but we have some problems in order to
separate the two tasks of the plugin a)get the bugs and b) insert them
into mrp.
We need to do these taks in separate threads to keep mrp running, since
the task of getting bugs could take a long time. However the task of
inserting the bugs into mrp must be done in the main thread ( if not,
mrp crashes )
The problem is if we do a g_thread_join() in the main bug, the main bug
blocks until the thread has finished, then we think use signals to
synchronize the two task.
The idea is: the main thread create the "get_bug_thread" and then
register the "get_complete" signal to the function that insert it into
mrp, something like this:
static
void main_thread(...)
{
[....]
g_thread_create(get_bug_thread,....);
g_signal_connect(....,"get_complete", insert_bugs, .... );
[....]
}
static
void get_bug_thread(...)
{
// Get the bugs
g_signal_emit(....,"get_complete",....);
}
static
void insert_bugs(...)
{
//Insert it into mrp
}
With this coding the main thread doesnt stop and the bugs are only
inserted when all of them are collected.
This is the theory, the problem is we dont know how to use signals.
Reading the gtk tutorial and the gtk api, we notice that the functions
that manage signals are widely linked to objects but we dont work with
objets in the plugin.
How can we use signals in this context ???
Regards.
-> Roberto <-
We are working in mozilla plugin but we have some problems in order to
separate the two tasks of the plugin a)get the bugs and b) insert them
into mrp.
We need to do these taks in separate threads to keep mrp running, since
the task of getting bugs could take a long time. However the task of
inserting the bugs into mrp must be done in the main thread ( if not,
mrp crashes )
The problem is if we do a g_thread_join() in the main bug, the main bug
blocks until the thread has finished, then we think use signals to
synchronize the two task.
The idea is: the main thread create the "get_bug_thread" and then
register the "get_complete" signal to the function that insert it into
mrp, something like this:
static
void main_thread(...)
{
[....]
g_thread_create(get_bug_thread,....);
g_signal_connect(....,"get_complete", insert_bugs, .... );
[....]
}
static
void get_bug_thread(...)
{
// Get the bugs
g_signal_emit(....,"get_complete",....);
}
static
void insert_bugs(...)
{
//Insert it into mrp
}
With this coding the main thread doesnt stop and the bugs are only
inserted when all of them are collected.
This is the theory, the problem is we dont know how to use signals.
Reading the gtk tutorial and the gtk api, we notice that the functions
that manage signals are widely linked to objects but we dont work with
objets in the plugin.
How can we use signals in this context ???
Regards.
-> Roberto <-
--
oooO
/ __\
| \ _ GNOME Desktop //||\\ www.gnome.org
\___/
oooO
/ __\
| \ _ GNOME Desktop //||\\ www.gnome.org
\___/