Locking a file for exclusive access
Hello all, I'm trying to use a "lock file" as a mean to check if there are 2 instances of my delivered program running. First step is testing it, so here goes... In a first instance of the lispworks IDE i define this : (defvar *lock-file* nil) (defun create-lock-file () (setf *lock-file* (open (dir+filename (data-path) "test.lock") :direction :output :if-exists :supersede :if-does-not-exist :create))) and execute the create-lock-file function, leaving the stream open. I can see the file being created on my hard drive. Then i do the same in a second instance of the IDE.. and get no error ! Even writing to the stream and calling finish-output appears to be working. I can open the file in notepad but cannot save it. I tried also :if-exists :overwrite. So here is my question : how can I ensure the stream i open is exclusively owned by my application ? Thanks in advance, Sacha