nanogui: two window is not created in multithread model?


Previous by date: 23 Jan 2002 15:46:09 -0000 Re: Completely un-urgent and almost off-topic speculati on, Simon Wood
Next by date: 23 Jan 2002 15:46:09 -0000 Re: nano-x questions, Greg Haerr
Previous in thread: 23 Jan 2002 15:46:09 -0000 Re: two window is not created in multithread model?, Darran D. Rimron-Molloy
Next in thread: 23 Jan 2002 15:46:09 -0000 Re: two window is not created in multithread model?, Greg Haerr

Subject: Re: [nanogui] two window is not created in multithread model?
From: Jordan Crouse ####@####.####
Date: 23 Jan 2002 15:46:09 -0000
Message-Id: <E16TPYC-0004cR-00@ns.censoft.com>

You cannot do Gr* calls in multiple threads.   Imagine the following senario:

You have two threads, but only 1 socket (opened during GrOpen).  Thread 1 
executes a GrNewWindow(), and blocks (waiting for the responding window ID).  
When that happens, the scheduler loads the other thread, which then does a 
GrGetScreenInfo(), for example.

At this point the response packet from the first request has arrived at the 
socket, so the second thread fails to block (because data is availble), but 
the wrong packet type is read because the second thread got the packet 
intended for the first thread.  We have no protection against things like 
this.

Jordan
 


On Tuesday 22 January 2002 19:32, shin woojai mentioned:
> I coded in multithreads. but I have known 
> that I can't use GrXXX function in another thread.
> 
> and I create window in each thread.  but it cause 'wrong packet type
> 50...'.
 
> Can't nano-x window stand in each threads?
> 
> 
> ie)    <thread 1>
>     GrOpen();
>     GrNewWindow(...);
>     ....
> 
>         <thread 2>
>     GrOpen();
>     GrNewWindow(...);
>     ....
> 
>     and I push keyboard.
> 
> result : wrong packet type 50 (expected 22)
>             wrong packet type 4 (expected 22)
>             wrong packet type 0 (expected 22)

Previous by date: 23 Jan 2002 15:46:09 -0000 Re: Completely un-urgent and almost off-topic speculati on, Simon Wood
Next by date: 23 Jan 2002 15:46:09 -0000 Re: nano-x questions, Greg Haerr
Previous in thread: 23 Jan 2002 15:46:09 -0000 Re: two window is not created in multithread model?, Darran D. Rimron-Molloy
Next in thread: 23 Jan 2002 15:46:09 -0000 Re: two window is not created in multithread model?, Greg Haerr


Powered by ezmlm-browse 0.20.