Article View: borland.public.cppbuilder.internet.socket
Article #1299Re: Passing info between threads
From: Lesley Anne
Date: Mon, 19 Feb 2007 21:48
Date: Mon, 19 Feb 2007 21:48
31 lines
2085 bytes
2085 bytes
> 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? Yes. > 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] ) That's the effect I'm trying to achieve, but I'm having trouble figuring out a thread-safe method of doing that. > 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). If the parameters are passed in, how/where do I put in a critical section lock? And does that do anything to help the scope problem if the VCL thread has gone on to something else by the time the SCTP thread picks this up? > 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. How do I do that?
Technical Details
Message-ID:
<45da1b21$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<45d9e83a$1@newsgroups.borland.com> <45da1385@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: "Lesley Anne" <mspfila (dash) brl (at) yahoo (dot) com> Newsgroups: borland.public.cppbuilder.internet.socket References: <45d9e83a$1@newsgroups.borland.com> <45da1385@newsgroups.borland.com> Subject: Re: Passing info between threads Date: Mon, 19 Feb 2007 16:48:47 -0500 Lines: 33 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: 144.160.5.25 Message-ID: <45da1b21$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1171921697 144.160.5.25 (19 Feb 2007 13:48:17 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail