Mail Archives: djgpp/1999/01/22/20:46:50
From: | leva AT hotmail DOT com
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | interprocess synchronization and "Sharing violation"
|
Date: | Sat, 23 Jan 1999 01:28:47 GMT
|
Organization: | Deja News - The Leader in Internet Discussion
|
Lines: | 37
|
Message-ID: | <78b8k7$um0$1@nnrp1.dejanews.com>
|
NNTP-Posting-Host: | 195.208.33.83
|
X-Article-Creation-Date: | Sat Jan 23 01:28:47 1999 GMT
|
X-Http-User-Agent: | Mozilla/4.07 [en] (Win95; U)
|
X-Http-Proxy: | 1.0 cc3.kapitza.ras.ru:3128 (Squid/1.1.21), 1.0 x16.dejanews.com:80 (Squid/1.1.22) for client 195.208.33.126, 195.208.33.83
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi there!
I'm quite new here, so please excuse me if my question is something obvious
and well known.
So the problem is following: my program is invoked by Windows application
(Pegasus Mail if you're curious) and is supposed to filter all incoming
e-mail. Unfortunately this Windows application is strong enough to create
some hundred of processes per second (and silly enough not to be able to
create single task-list) and it really uses all its power - my program is
executed simultaneously in MANY instances. The story goes that all instances
of my program want to write their output to the same directory with unique
filenames. Even more important - Windows will crash if many VM (they create
new virtual machine for each DOS-BOX) created. So I really prefer to test if
an instance of my program is already running and terminate as soon as
possible (having task file appended), just in hope that it terminates faster
than new processes are created. So I need a simple semaphore or mutex or
whatever to be able to synchronize execution of all this zoo...
Thanks to DJ, O_EXCL is working NOW as it should - I have a single lock file
to be owned and use __dpmi_yield() if the lock is busy. Now it works wonderful
under Windows 95. Unfortunately this approach fails on Windows 3.11. Windows
complain about Sharing Violation :-(. Perhaps somebody can suggest something
here?
1. Is there any way to make windows 3.11 return with error rather than pop a
messagebox to user?
2. Is there any way to synchronize processes without relying on the file
system? I would like to have an approach that works equally well on
95/98/NT/3.1
advaTHANKSnce
-Leva.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
- Raw text -