XForms: pthreads causing crash...

From: Jeff Pierce (wd4nmq@comcast.net)
Date: Wed Apr 09 2003 - 01:20:35 EDT

  • Next message: Zaphod B: "Re: XForms: XForms seems to be in good hands"

    # To subscribers of the xforms list from Jeff Pierce <wd4nmq@comcast.net> :

    I have an xforms app that accesses a server to get a users list that is
    displayed in a browser object.

    Ok, I have had it working for along time, but while the server is being
    accessed and the data fed into the browser object, all other objects
    freeze because of the single threaded design. Ok, lets do the serve
    access as a thread.

    Which I do using the pthread library. I test out threaded code in a
    non-xforms app and it runs fine.

    But, in the xforms app a weird thing happens.

    I start the app and press the button to go get the server data. Heres a
    flow of what the code does.
    1. deactivate the browser object to keep users from clicking in it.
    2. Change browser object background color to let user know it is
       updating.
    3. Tell the thread to go get the data.
    4. At this point the button callback ends and xforms should return to
    it's event handler ready fo another event.
    5. In the thread, after it has downloaded and sorted the data, it puts
    the data in the browser, changes the background color to normal and
    activates the browser object.

    Now here's the problem, sometimes it works perfectly. I hit the update
    button, the browser color changes and debug messages I have in the
    thread are printed. I can click on other input objects and the cursor
    goes there while the server thread is doing it's thing. Just what I wanted.

    But, most of the time, while the server is being accessed the clicked on
    object does NOT get the cursor, and when the server access completes,
    the browser data is filled in, etc, the app crashes with this error:
    X Error of failed request: BadWindow (invalid Window parameter)
       Major opcode of failed request: 38 (X_QueryPointer)
       Resource id in failed request: 0x20000d1
       Serial number of failed request: 173187
       Current serial number in output stream: 173187

    Like I said sometimes it works fine, but most of the time I get this
    failure.

    -- 
    Jeff, wd4nmq
    wd4nmq@comcast.net
    http://mywebpages.comcast.net/wd4nmq
    

    _________________________________________________ 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/ Development: http://savannah.nongnu.org/files/?group=xforms



    This archive was generated by hypermail 2b29 : Wed Apr 09 2003 - 01:22:08 EDT