On Jan 22 2003, at 14:02, Liberty Young was caught saying:
> A customer of ours is using a program named microcom called from his own
> php scripts to interface with it. He wants to know how he can put an
> exlusive lock on the program from php and then release it. He's doing
> this so more than one person can use microcom (which is hooked up to a
> device sitting on the serial port). He said that flock() in php only
> works with file pointers, not processes.
What he probably wants to do is create a lock file of his own,
let's call it myapp_lock_file. Do an flock() on that file, and
only when that flock returns, execute the microcom process.
(Or if it's a single process that's already running, then wait
until flock returns to communicate to it). I don't think flock()
blocks until the file is available, so you're going to have
to spin in a tight loop, which is really going to show up in
system performance.
I'm assuming you mean that more than one person can't use microcom
at the same time? Otherwise locking is not required?
~Deepak
--
Deepak Saxena -
dsaxena@plexity.net
They who would give up an essential liberty for temporary security,
deserve neither liberty or security - Benjamin Franklin -