Article View: borland.public.cppbuilder.internet.socket
Article #1248Re: Passing info between threads
From: Michael Harris
Date: Fri, 23 Feb 2007 15:20
Date: Fri, 23 Feb 2007 15:20
64 lines
2799 bytes
2799 bytes
Lesley
data is stored in a csv type file format.
the main vcl thread updates these files with writeeclisive.
then post a message to the thread to update its data.
so the thread is busy. only interrupted if some additional or current data
is changed
sctp_eventLoop may need to periodically check the message que ?
while (! Terminated ) {
if (sctp_eventLoop() < 0)
break ;
if(!DoThreadMessage( ) )
break;
}
bool __fastcall TMonitorThread::DoThreadMessage(void)
{
if (Terminated) return False;
MSG msg;
ZeroMemory (&msg, sizeof (MSG));
if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE ))
{
switch(msg.message)
{
case WM_QUIT :
Terminate();
return False;
case TM_CLIENTCHANGED :
RenewItemInfo(msg.lParam);
break;
(...) etc
}
}
return True;
}
--
Michael
"Lesley Anne" wrote in message
> But I can't have the thread sleeping or waiting or anything else that
> would keep it from processing the library's event loop. It might be a
> while before the next time the main unit initiates an outgoing message,
> but in the meantime, the library still needs to keep looking for incoming
> messages. It relies on sctp_eventLoop() being called continuously.
> Whatever I add into the Execute's while loop has to co-exist peacefully
> with:
>
> while (! Terminated ) {
> if (sctp_eventLoop() < 0)
> break ;
> }
>
> and not block that eventLoop from happening.
>
>
Technical Details
Message-ID:
<45df061a$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.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> <h21mt21bg7maqp25d2lqkr9b1iet0eu3g6@4ax.com> <45db2486$1@newsgroups.borland.com> <vj8nt2llf7deda6ioqggci4rds885qcmne@4ax.com> <45dcc0cb@newsgroups.borland.com> <45dd557c$1@newsgroups.borland.com> <45ddf727@newsgroups.borland.com> <45de1d0f@newsgroups.borland.com> <45de262d$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 Reply-To: "Michael Harris" <techonos-NO-SPAM-@attbi.com> From: "Michael Harris" <techonos-NO-SPAM-@attbi.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <45d9e83a$1@newsgroups.borland.com> <h21mt21bg7maqp25d2lqkr9b1iet0eu3g6@4ax.com> <45db2486$1@newsgroups.borland.com> <vj8nt2llf7deda6ioqggci4rds885qcmne@4ax.com> <45dcc0cb@newsgroups.borland.com> <45dd557c$1@newsgroups.borland.com> <45ddf727@newsgroups.borland.com> <45de1d0f@newsgroups.borland.com> <45de262d$1@newsgroups.borland.com> Subject: Re: Passing info between threads Date: Fri, 23 Feb 2007 09:20:45 -0600 Lines: 66 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: 76.187.71.134 Message-ID: <45df061a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1172243994 76.187.71.134 (23 Feb 2007 07:19:54 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news2.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail