On Fri, 9 Apr 2010 13:18:09 -0700 (PDT)
"Adam Chyla [PL]" <[email protected]> wrote:
> Hi. 
> I have that code:
> 
> void MainWindow::on_ok_clicked()
> {
>    pid_t pid = fork(); // There is an error
>    switch (pid)
>    {
> //...
>    }
> }
> 
> When I compiled program the gtkmm returns:
> Mer: ../../src/xcb_io.c:249: process_responses: Assertion `(((long)
> (dpy->last_request_read) - (long) (dpy->request)) <= 0)' failed.
> Mer: ../../src/xcb_io.c:249: process_responses: Assertion `(((long)
> (dpy->last_request_read) - (long) (dpy->request)) <= 0)' failed.
> Aborted (core dumped)

This won't work.  X won't allow two processes to share the same
resources.

If you are fork()ing to exec() another program, then you will need to
start a new thread and fork() from that (the new process will only
reproduce the thread of execution of the calling thread rather than
the GUI thread, which is OK). However you can only call
async-signal-safe functions between the fork() and the exec() in a
multi-threaded process, so do any preparatory work before the fork().

If you are not fork()ing in order to exec() then you need either to do
it all in threads or redesign your program.

Chris


_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to