XForms: keyboard entry and threads.

From: Jeff Pierce (wd4nmq@comcast.net)
Date: Thu Apr 10 2003 - 00:55:01 EDT

  • Next message: Jean-Marc Lasgouttes: "Re: XForms: Today's commits"

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

    Yes, the threads subject again.

    I searched the list archives and found a posting from spl about
    replacing fl_do_forms() with fl_check_forms() with the locks around it.
    And with the lock around the threaded code that writes to the browser, I
    thought that might fix it. Yes, I have XInitThreads() as the first call
    before any other xforms or X calls.
    Here is a snippet of my threaded code:

       pthread_mutex_lock(&browserLock);
       topLine = fl_get_browser_topline(fd_testgui->nodeList);
       fl_freeze_form(fd_testgui->testgui);
       fl_clear_browser(fd_testgui->nodeList);
       if(pListHead){
         temp = pListHead;
         do{
           sprintf(line, "%-9s%-39s%6d", (temp->station)->call,
                 (temp->station)->data, (temp->station)->id);
           fl_add_browser_line(fd_testgui->nodeList, line);
           temp = temp->next;
         }while(temp != NULL);
         fl_set_browser_topline(fd_testgui->nodeList, topLine);
       }
       fl_set_object_color(fd_testgui->nodeList,FL_WHITE,FL_GREEN);
       fl_set_object_label(fd_testgui->serverInfo, "");
       fl_activate_object(fd_testgui->nodeList);
       fl_unfreeze_form(fd_testgui->testgui);
       pthread_mutex_unlock(&browserLock);
    }
    This is run after a sever is accessed and data is formated ready to be
    displayed. Here it the main loop code:
       while(1){
         timeout.tv_sec = 0;
         timeout.tv_usec = 10000;
         select(0, NULL, NULL, NULL, &timeout);
         pthread_mutex_lock(&browserLock);
         fl_check_forms();
         pthread_mutex_unlock(&browserLock);
       }

    Ok at first everthing seems to work. I can access the server and write
    it to the browser while selecting other objects, buttons ,etc. But then
    I select an input object and type. No characters appear and the app
    freezes. Have to kill it externally. This happens no matter when I do
    it. Before the browser section is called or after it. Keyboard input
    freezes the app. I even tried hitting the keyboard when NO OBJECT had
    focus. Same result, app freezes.

    Any ideas?

    -- 
    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 : Thu Apr 10 2003 - 00:56:39 EDT