Re: XForms: xforms and pthread

From: Hao Zhang (Richard) (richard@atlas.dgp.toronto.edu)
Date: Mon Sep 09 2002 - 01:40:02 EDT

  • Next message: Reed Riddle: "XForms: Odd tabfolder problem"

    # To subscribers of the xforms list from "Hao Zhang (Richard)" <richard@atlas.dgp.toronto.edu> :

    Right on! Thanks. Now it works well. I was able to find the same answer
    from dejanews.com, where the following code segment is suggested:

    ......

       if (XInitThreads()) {
          if (XtToolkitThreadInitialize()) {
            ;
          } else {
            printf("Xlib Threads: Unsupported level 2.\n");
            return -1;
          }
        } else {
          printf("Xlib Threads: Unsupported level 1.\n");
          return -1;
        }

    .....

    Richard.

    On Sun, 8 Sep 2002 spl@ncmir.ucsd.edu wrote:

    > # To subscribers of the xforms list from spl@ncmir.ucsd.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.
    >
    > You must initialize the X library for threadedness with the function
    > XInitThreads(). It must be called before any Xlib functions,
    > including fl_initialize(). Here's what I do to set up a multithreaded
    > OpenGL/XForms application:
    >
    > void preinitialize_forms( int *argc, char **argv )
    >
    > {
    >
    > CONCURRENCY( 4 );
    >
    > XInitThreads(); /* Initialize X for threads */
    > #ifdef GLX_SUN_init_threads
    > if ( strstr( glXGetClientString( fl_get_display(), GLX_EXTENSIONS ),
    > "GLX_SUN_init_threads" ) ) {
    >
    > if ( !glXInitThreadsSUN() )
    > abend( "Unable to init GL for multithreaded rendering" );
    >
    > }
    > #endif
    >
    > fl_set_border_width( -1 );
    > fl_initialize( argc, argv, argv[0], NULL, 0 );
    >
    > }
    >
    > This application renders to four separate GLCanvases.
    >
    > spl
    > _________________________________________________
    > 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/
    >
    >

    _________________________________________________
    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 : Mon Sep 09 2002 - 01:42:18 EDT