seeking networking and pthreads advice
Christian Schaefer
caefer@krachstoff.net
Tue Apr 1 08:45:00 GMT 2003
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
More information about the Gcc-help
mailing list