Re: XForms: Threadsafe

From: Antonio Buitrago (
Date: Thu Jun 01 2000 - 07:26:02 EDT

  • Next message: Dick Middleton: "XForms: TAB navigation"

    # To subscribers of the xforms list from Antonio Buitrago <> :

    I have solved a similar problem using this (Chapter 4 in XForms Manual):

    1.- Connect a function to "fd" :

    static int fd;

    int inicRefrescoForms ()
        fl_add_io_callback (fd,FL_READ,
       return OK;

    2.- The callback function waits for a message from "fd":

       The structure "msj" (in below function) is a message which contain the "what
    to do" information.

    void refresca_forms_io_callback (int fd, void * dato)
      TD_msj_refresco msj;
      int nBytes;

        if ((nBytes = read(fd, &msj, sizeof(msj))) > 0)
          switch (msj.form)
            case FORM_PPAL:
            case FORM_INICIAL:
                  refresca_inicial (&msj);
            case FORM_CALIBRACION:
                 refresca_calibracion (&msj);



    void refresca_ppal(TD_msj_refresco *msj)

       switch (msj->comando)
             case PPAL_REFRESCA_FECHA:
              fl_set_object_label (fd_ppal->text_fecha, (char *)msj->args);



    3.- Now you can send a "msj" from a thread to Xforms.

            I hope it helps you (Sorry my bad english).

            A. Buitrago

    Paolo Prandini wrote:
    > I implemented a big program using XForms whose purpose is to control some
    > industrial machinery; the same Linux PC running X is also controlling the
    > I/O
    > (motors, lights, etc).
    > I need to show some real time values and alarms in the same window where
    > are located the pushbuttons activating the various functions .
    > I didn't even think of it, but in fact I designed everything as if
    > XForms were threadsafe.
    > BUT IT IS NOT! Now I have some mysterious lockups and I traced them to
    > this kind of problem.
    > The possible solutions are:
    > a) rewrite everything with another lib that is threadsafe
    > b) fix XForms
    > But to fix XForms I need the source code! What about letting me do this
    > kind of modification? Or maybe there is a threadsafe version in the works?
    > Thanks for any suggestion.
    > Paolo Prandini
    To unsubscribe, send the message "unsubscribe" to or see
    XForms Home Page:
    List Archive:

    This archive was generated by hypermail 2b29 : Thu Jun 01 2000 - 07:31:27 EDT