Re: XForms: xforms and pthread

From: T.C. Zhao (tc_zhao@yahoo.com)
Date: Sun Sep 08 2002 - 23:17:32 EDT

  • Next message: spl@ncmir.ucsd.edu: "Re: XForms: xforms and pthread"

    # To subscribers of the xforms list from "T.C. Zhao" <tc_zhao@yahoo.com> :

    X in its typical configuration is not thread safe, so what you're doing is a
    no no. What you can do is to poll a semaphore in the main thread and have the
    working thread signalling the semaphore, and do the update from the main
    thread.
    -TC
    --- "Hao Zhang (Richard)" <richard@atlas.dgp.toronto.edu> wrote:
    > # To subscribers of the xforms list from "Hao Zhang (Richard)"
    > <richard@atlas.dgp.toronto.edu> :
    >
    >
    > Hi. I am new to xforms and pthread, I admit, and I am having some
    > problems. This should be a simple situation for you experts out there.
    >
    > I have a GUI written using the Forms library. The GUI contains a main form
    > with some buttons and displays on it. When a "start" button on the main
    > form is pressed, some length computation is to be carried out. In order
    > for the form to still be responsive, I used pthread_create() to spawn
    > another thread, and do the computation in this thread. I can press the
    > "abort" button on the main form to pthread_cancel() this thread.
    >
    > Now all I want to do is for the new thread to be able to write something
    > to the main form, i.e., when it has completed the computation. But when I
    > do an fl_set_object_label(fd_main_fm->obj, "AHA") from this thread, I get
    > this
    >
    > Xlib: unexpected async reply (sequence 0x9ff)!
    >
    > error which kills my whole application. Could anyone help me out?
    >
    > Thanks a lot.
    >
    > Richard.
    >
    >
    > _________________________________________________
    > To unsubscribe, send the message "unsubscribe" to
    > xforms-request@bob.usuhs.mil or see
    > http://bob.usuhs.mil/mailserv/xforms.html
    > XForms Home Page: http://world.std.com/~xforms
    > List Archive: http://bob.usuhs.mil/mailserv/list-archives/
    >

    __________________________________________________
    Do You Yahoo!?
    Yahoo! Finance - Get real-time stock quotes
    http://finance.yahoo.com
    _________________________________________________
    To unsubscribe, send the message "unsubscribe" to
    xforms-request@bob.usuhs.mil or see
    http://bob.usuhs.mil/mailserv/xforms.html
    XForms Home Page: http://world.std.com/~xforms
    List Archive: http://bob.usuhs.mil/mailserv/list-archives/



    This archive was generated by hypermail 2b29 : Sun Sep 08 2002 - 23:21:06 EDT