nanogui: Corrupted Packet Nano-X
Subject:
WG: [nanogui] Corrupted Packet Nano-X
From:
"Detzner, Peter" ####@####.####
Date:
12 Sep 2007 07:49:35 +0100
Message-Id: <C68208999FE4B94888BDFF4D9B8CF68CE0F14E@w2kex2.insta.de>
-----Ursprüngliche Nachricht-----
Von: Greg Haerr ####@####.####
Gesendet: Mittwoch, 12. September 2007 08:11
An: Detzner, Peter
Cc: Nanogui List
Betreff: Re: [nanogui] Corrupted Packet Nano-X
> So maybe the multithreading is the problem?
I should have asked this in the beginning, its definitely the problem.
Despite having THREADSAFE=Y, if more than one makes a request with a non-void GrXXX function (that is, one that requires a response from the server), then the client/server interaction on the single pipe to the application gets out of sync, and the "corrupted packet" message is generated.
This is because two threads have attempted to read or write the pipe at the same time, and junk gets written in the middle of a packet.
The THREADSAFE option puts mutex's to protect against a task switch between two writers, but can't protect against a thread trying to read a response while another, usually the main thread, is in GrGetNextEvent.
Regards,
Greg
ps: please post reponses to the list