nanogui: Thread: two window is not created in multithread model?


[<<] [<] Page 1 of 1 [>] [>>]
Subject: two window is not created in multithread model?
From: "shin woojai" ####@####.####
Date: 23 Jan 2002 02:33:21 -0000
Message-Id: <OE718iG2Yjt7LbW5PGF000123d8@hotmail.com>

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)
Subject: RE: [nanogui] two window is not created in multithread model?
From: "Darran D. Rimron-Molloy" ####@####.####
Date: 23 Jan 2002 03:48:36 -0000
Message-Id: <HAEDKNJBOGMNPFLJGKNKGEBCCCAA.ddrm@digital-science.net>

> result : wrong packet type 50 (expected 22)
>             wrong packet type 4 (expected 22)
>             wrong packet type 0 (expected 22)

I get this when I run multiple applications connecting to the same
server.... Sometimes...

	-Darran




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)
Subject: Re: [nanogui] two window is not created in multithread model?
From: "Greg Haerr" ####@####.####
Date: 23 Jan 2002 15:58:15 -0000
Message-Id: <049301c1a424$e42e44e0$3aba46a6@xmission.com>

:  the second thread got the packet 
: intended for the first thread.  We have no protection against things like 
: this.

If you want to run multi-thread, you will need to protect the
entry of each Gr* nano-X call with a global semaphore.  This
could be done in nanox/srvnet.c.

Regards,

Greg


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

Greg -

Oops, I think you got the wrong file.   The server is single threaded, so a 
semaphore would do you no good there.  However, you could have thread 
protection in the client by adding a semaphore to each of the Gr* calls in 
client.c (ecos already does something like this with the 
ACCESS_PER_THREAD_DATA() macro).

Jordan

On Wednesday 23 January 2002 08:44, Greg Haerr mentioned:
> :  the second thread got the packet
> : intended for the first thread.  We have no protection against things like
> : this.
>
> If you want to run multi-thread, you will need to protect the
> entry of each Gr* nano-X call with a global semaphore.  This
> could be done in nanox/srvnet.c.
>
> Regards,
>
> Greg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####
Subject: Re: [nanogui] two window is not created in multithread model?
From: "Greg Haerr" ####@####.####
Date: 23 Jan 2002 16:31:58 -0000
Message-Id: <04f301c1a429$99edd6c0$3aba46a6@xmission.com>

: Oops, I think you got the wrong file.   The server is single threaded, so a 
: semaphore would do you no good there.  However, you could have thread 
: protection in the client by adding a semaphore to each of the Gr* calls in 
: client.c (ecos already does something like this with the 
: ACCESS_PER_THREAD_DATA() macro).

Yep, you're right - I meant client.c

Regards,

Greg


[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.