Article View: borland.public.cppbuilder.nativeapi
Article #327Re: Conceptual design question...
From: Bob Gonder
Date: Wed, 30 Apr 2008 14:32
Date: Wed, 30 Apr 2008 14:32
36 lines
2101 bytes
2101 bytes
Mike Collins wrote:
>i'm looking for some pointers from the *experts*.
Do I qualify?
>i have a Service that is informed when a user logs on or off.
> I then have four other TThreads that are hardware polling
>
>I'm looking for a suitably robust and streamline method of informing my
>child threads of the users logon / off. My current demo uses
>PostThreadMessage but i was wondering if there is a better method of
>Inter-Thread Communication. This system works ok but i've managed to spoof
>the messages from a rouge service so i was looking for a more secure system
>of ITC.
I think for the highest security, you go with memory-only transfers.
If the threads are already polling, then simply extend the poll to
a global variable, or a public TThread variable.
bool ThreadOneITC = false;
bool ThreadTwoITC = false;
MessageHandler()
{
case logon:
ITCdata = LOGON;
ThreadOneITC = true;
ThreadTwoITC = true;
break;
If ITC can occur faster than the threads poll, then you
would want to FIFO the data, and have the thread re-poll
before sleeping.
For a simple bool flag, locking shouldn't be an issue.
Technical Details
Message-ID:
<hlvg145v5292euvns2sg6klblk4sgjv9bq@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!news.isoc.lu!newsgroups.borland.com!not-for-mailReferences:
<4817b8f3@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,7f6e6520c419b9ba X-Google-Attributes: gid10cc67,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Conceptual design question... Date: Wed, 30 Apr 2008 07:32:34 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <hlvg145v5292euvns2sg6klblk4sgjv9bq@4ax.com> References: <4817b8f3@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 67.77.144.65 X-Trace: newsgroups.borland.com 1209565953 67.77.144.65 (30 Apr 2008 07:32:33 -0700) Lines: 38 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!news.isoc.lu!newsgroups.borland.com!not-for-mail