From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17530 invoked by alias); 2 Apr 2003 05:56:23 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 17519 invoked from network); 2 Apr 2003 05:56:22 -0000 Received: from unknown (HELO lifesupport.shutdown.com) (66.93.79.177) by sources.redhat.com with SMTP; 2 Apr 2003 05:56:22 -0000 Received: (from llewelly@localhost) by lifesupport.shutdown.com (8.11.2/8.11.2) id h325r9Y18296; Tue, 1 Apr 2003 21:53:09 -0800 (PST) To: Christian Schaefer Cc: gcc-help@gcc.gnu.org Subject: Re: seeking networking and pthreads advice Reply-To: gcc-help@gcc.gnu.org References: <1049194737.1344.18.camel@christian.schaefer.home> From: LLeweLLyn Reese Date: Wed, 02 Apr 2003 05:56:00 -0000 In-Reply-To: <1049194737.1344.18.camel@christian.schaefer.home> Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-04/txt/msg00008.txt.bz2 Christian Schaefer writes: > hi there, > > I want to write a networking module which communicates with specially > prepared messages over tcp/ip sockets. This doesn't sound like gcc question. This is a design question, or a threads question. I suggest you try a more appropriate forum - comp.programming.threads, for example. > thats no problem. > those messages belong to different dialogs. meaning: every dialog is a > sequence of client and server messages. > but since there can be several dialogs active, I had following idea: > > I want to have a queue of pthreads. one for each open dialog. and a > message-engine, that gives the identifier of the current message to each > thread until one answers "that message is mine". > > I would know how to do this, but since the message handling requires a > lot of data from the application I wondered how to give the thread > access to that data. > > what I did is this: > I build a rather complicated struct with all general data in it. > and as a argument to the pthread I gave a pointer to that struct. > is this ok, or should i use global variables or is there a much better > way that I can not think of right now? > > thanks in advance > /christian