🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #1298

Re: Passing info between threads

#1298
From: Paul at NCF
Date: Mon, 19 Feb 2007 21:16
23 lines
1754 bytes
Hi,

I might be missing something here, or misunderstanding your design or 
problem.  But it seems you want to pass a string and assoc ID to the thread, 
to then call sctp_send to send this information?

Why don't you just call the send method in the thread with (stack based) 
parameters rather than globals:

    if (sctpThread)
        sctpThread->Send( String(buffer),  associationID[Site] )

Then make the Send method thread safe with a critical section to do any 
actions that need it (around adding or removing items from lists / queues). 
eg. put the parameters passed in on to a queue, and signal the thread there 
is a job to do.  The thread then wakes up, and removes the oldest job from 
the queue thread safely, until the queue is empty.

As I said, I might be missing something.

Regards,

Paul 
Technical Details
Message-ID: <45da1385@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <45d9e83a$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,234a9a04e64155b0
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Paul at NCF" <notplmacca@clara.co.uk>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <45d9e83a$1@newsgroups.borland.com>
Subject: Re: Passing info between threads
Date: Mon, 19 Feb 2007 21:16:33 -0000
Lines: 25
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3028
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 86.132.187.248
Message-ID: <45da1385@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1171919749 86.132.187.248 (19 Feb 2007 13:15:49 -0800)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail