Article View: borland.public.cppbuilder.nativeapi
Article #1299Re: CreateProcess() in Automation server freezes caller
From: Bob Gonder
Date: Thu, 13 Sep 2007 00:03
Date: Thu, 13 Sep 2007 00:03
27 lines
2273 bytes
2273 bytes
Ok, so taking Remy's suggestion (which is usually a good idea,BTW) Your Main Application (MA) spawns the automation server (AS). It should not wait for anything, just continue it's message loop. (maybe set a flag so it doesn't spawn another copy) MA is non-blocking. The AS, on a timer event spawns a thread that spawns the 3rdParty. The thread waits, but the Timer event continues after spawning the thread. Timer Event is non-blocking. AS is not blocked. Thread is blocking on 3rd party. After the download, the thread raises an event, or PostMessage to the AS that the download is complete, then exits. The AS sees the message and either processes the data (blocking) or preferably spawns another thread to process the data (non-blocking) (or the original download thread could have processed the data, also non-blocking to AS). After the data is processed, AS (or the processing thread) notifies MA (PostMessage or other IPC) and continues waiting for another timer event. Simple. MA and AS use their normal message loop, no extra checking required. Only one block, and that's in a thread that is not connected to the UI.
Technical Details
Message-ID:
<pauge3p2dusj7kt3dngg0fh4pe2hjvusek@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<46e69558$1@newsgroups.borland.com> <46e6cfc6$1@newsgroups.borland.com> <46e7c1df$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,ab74d8f845bd4978 X-Google-Attributes: gid10cc67,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: CreateProcess() in Automation server freezes caller Date: Wed, 12 Sep 2007 17:03:04 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <pauge3p2dusj7kt3dngg0fh4pe2hjvusek@4ax.com> References: <46e69558$1@newsgroups.borland.com> <46e6cfc6$1@newsgroups.borland.com> <46e7c1df$1@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.184 X-Trace: newsgroups.borland.com 1189641781 67.77.144.184 (12 Sep 2007 17:03:01 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail