nanogui: GrGetWindowInfo and threads


Previous by date: 21 May 2010 15:11:07 -0000 Re: Solid background under variable-width fonts, Greg Haerr
Next by date: 21 May 2010 15:11:07 -0000 Re: Error during compilation for sh4 target file system, Nigel
Previous in thread: 21 May 2010 15:11:07 -0000 GrGetWindowInfo and threads, Łukasz Wójcicki
Next in thread:

Subject: Re: [nanogui] GrGetWindowInfo and threads
From: "Greg Haerr" ####@####.####
Date: 21 May 2010 15:11:07 -0000
Message-Id: <049b01caf8f7$d3a69240$6564a8c0@winXP>

:I have two threads in my application. I have compiled microwindows with
: LINK_APP_INTO_SERVER=Y and THREADSAFE=Y . When I using GrGetWindowInfo
: in second thread , this thread is frozen . Why ? Is there any solution
: for this problem ?

The nano-X client/server protocol and client lib wasn't designed
for multi-threaded applications, but was made to work later
by adding mutexes around each call, which is what THREADSAFE
enables.  The mutexes were added so that a thread isn't preempted
before writing all the protocol data to the server, which would
cause desynchronization and packet corruption.

There are still sometimes issues when multiple threads are used with
GrXXX calls which require a server round trip (that is, require 
return data).  GrGetWindowInfo is one of these.

In your case, the server is linked with the application.  The original
implementation of THREADSAFE was concerned only about
protecting client library threads, while the server ran asynchronously.
Your program will execute the "server" side synchronously.  There
may be some cases where deadlock could occur (I'm not coming
up with any specific cases right now)

I would recommend that only one thread make calls that return
return information, and/or make these calls early in the initialization
portion and save the results in static data.

Hope this helps.

Regards,

Greg


Previous by date: 21 May 2010 15:11:07 -0000 Re: Solid background under variable-width fonts, Greg Haerr
Next by date: 21 May 2010 15:11:07 -0000 Re: Error during compilation for sh4 target file system, Nigel
Previous in thread: 21 May 2010 15:11:07 -0000 GrGetWindowInfo and threads, Łukasz Wójcicki
Next in thread:


Powered by ezmlm-browse 0.20.