public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* seeking networking and pthreads advice
@ 2003-04-01  8:45 Christian Schaefer
  2003-04-02  5:56 ` LLeweLLyn Reese
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Schaefer @ 2003-04-01  8:45 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: seeking networking and pthreads advice
  2003-04-01  8:45 seeking networking and pthreads advice Christian Schaefer
@ 2003-04-02  5:56 ` LLeweLLyn Reese
  2003-04-02  6:53   ` Re[2]: " Christian Schäfer
  0 siblings, 1 reply; 3+ messages in thread
From: LLeweLLyn Reese @ 2003-04-02  5:56 UTC (permalink / raw)
  To: Christian Schaefer; +Cc: gcc-help

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re[2]: seeking networking and pthreads advice
  2003-04-02  5:56 ` LLeweLLyn Reese
@ 2003-04-02  6:53   ` Christian Schäfer
  0 siblings, 0 replies; 3+ messages in thread
From: Christian Schäfer @ 2003-04-02  6:53 UTC (permalink / raw)
  To: LLeweLLyn Reese

hi LLeweLLyn,

> 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.

you're probably right. but I am not a news/forum reader and strongly
prefere mailing lists. maybe you have an advice for a good programming
ml since I couldn't find a good one since month..

 
regards
/Christian                   mailto:caefer@krachstoff.net

---


I propose that the following character sequence for joke markers:

:-)

                             19-Sep-82 11:44    Scott E  Fahlman

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-02  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-01  8:45 seeking networking and pthreads advice Christian Schaefer
2003-04-02  5:56 ` LLeweLLyn Reese
2003-04-02  6:53   ` Re[2]: " Christian Schäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).