From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13011 invoked by alias); 1 Apr 2003 08:45:08 -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 12999 invoked from network); 1 Apr 2003 08:45:05 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.183) by sources.redhat.com with SMTP; 1 Apr 2003 08:45:05 -0000 Received: from [212.227.126.160] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 190HOC-0006bq-00 for gcc-help@gcc.gnu.org; Tue, 01 Apr 2003 10:45:04 +0200 Received: from [217.82.141.164] (helo=[192.168.0.2]) by mrelayng.kundenserver.de with asmtp (Exim 3.35 #1) id 190HOB-0006pT-00 for gcc-help@gcc.gnu.org; Tue, 01 Apr 2003 10:45:03 +0200 Subject: seeking networking and pthreads advice From: Christian Schaefer To: gcc-help@gcc.gnu.org Content-Type: text/plain Organization: Message-Id: <1049194737.1344.18.camel@christian.schaefer.home> Mime-Version: 1.0 Date: Tue, 01 Apr 2003 08:45:00 -0000 Content-Transfer-Encoding: 7bit X-SW-Source: 2003-04/txt/msg00002.txt.bz2 hi there, I want to write a networking module which communicates with specially prepared messages over tcp/ip sockets. 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