seeking networking and pthreads advice

LLeweLLyn Reese llewelly@lifesupport.shutdown.com
Wed Apr 2 05:56:00 GMT 2003


Christian Schaefer <caefer@krachstoff.net> 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



More information about the Gcc-help mailing list