launching on Wintel/inter-process communication

Richard Gaskin ambassador at fourthworld.com
Tue Dec 3 15:13:01 EST 2002


Dar Scott wrote:

> 
> On Tuesday, December 3, 2002, at 11:27 AM, Richard Gaskin wrote:
> 
>> By directory polling, do you mean checking the existence of a file
>> rather
>> than its contents?  That's the approach I took, much faster than always
>> accessing the file.
> 
> Cool!  I would guess that would avoid locking problems, too.  (Let's
> see; scribble under Gaskin in the rollodex, "file-based IPC expert".)

I don't know how much of an expert one can be on something this relatively
simple, but maybe Ken and I can earn that title by beefing things up a bit:

While he and I were brainstorming over this last night, he suggested the
basic method could be extended for use between instances of the same app to
more gracefully handle a double-clicked file:

When the app first opens it leave a file in the temp folder which acts as an
"is running" flag.  If a document is double-clicked, a second instance of
the app is launched, and on startup (before it's even visible) it checks the
"is running" file and if it's there it writes the global $1 to a
communication file and exits.  The first instance, still polling, sees the
communcation file and opens the file it references before deleting the temp
communication file.

I'm reluctant to roll out such an approach for all my apps, as even a %0.05
performance degradation adds up (maybe far less; I was benchmarking file
existence on a slow PII while my P4 gets fixed), but when you really need it
it seems maybe a small price to pay.

-- 
 Richard Gaskin 
 Fourth World Media Corporation
 Developer of WebMerge 2.1: Publish any database on any site
 ___________________________________________________________
 Ambassador at FourthWorld.com       http://www.FourthWorld.com
 Tel: 323-225-3717                       AIM: FourthWorldInc




More information about the metacard mailing list