Questions tagged [filelock]

File locks are locks held by an application, preventing interference from other processes. Locks may be advisory (may be ignored by others), or mandatory, enforced by the operating system, depending on implementation.

File locks are locks held by an application, preventing interference from other processes. Locks may be advisory (may be ignored by others), or mandatory, enforced by the operating system, depending on implementation.

190 questions
1
vote
1 answer

syncro multiprocess with FileLock() read/write on same file c++ win32

i'm traing to do 2 process that do this: Process A (the client) : - It opens a temporary file for writing (use GetTempFileName to obtain a unique file name). - It starts Process B passing as argument the name of the file. - It reads from standard…
user3535936
  • 116
  • 1
  • 5
1
vote
1 answer

In Java What is the guaranteed way to get a FileLock from FileChannel while accessing a RandomAccessFile?

I am trying to use FileLock lock(long position, long size,boolean shared) in FileChannel object As per the javadoc it can throw OverlappingFileLockException. When I create a test program with 2 threads lock method seems to be waiting to acquire…
nbhat
  • 51
  • 7
1
vote
1 answer

Close a file handle opened by .NET

I'm working on a script to rename files based on EXIF data. param([string]$path) # http://blogs.technet.com/b/jamesone/archive/2007/07/13/exploring-photographic-exif-data-using-powershell-of-course.aspx [reflection.assembly]::loadfile(…
Gerald Schneider
  • 17,416
  • 9
  • 60
  • 78
1
vote
3 answers

Windows (optionally Cygwin): Removing file which is locked by another process, from command line

I would like to delete a file, which is locked by another process, FROM THE COMMAND LINE (Windows 7). Note that I am aware that this might cause all kind of havoc, including losing all my data and making Alan Turing rotate in his grave. In my…
user1934428
  • 19,864
  • 7
  • 42
  • 87
1
vote
1 answer

Can one JVM aquire two shared FileLocks?

How can I aquire two shared FileLocks? I have the following test code: File file = new File(lockDir, "tmp.lock"); file.createNewFile(); FileChannel channel = new RandomAccessFile(file, "r").getChannel(); boolean shared = true; FileLock lock1 =…
Karussell
  • 17,085
  • 16
  • 97
  • 197
1
vote
1 answer

Force LibGit2Sharp to interact with files it says are partially locked

I'm trying to use the C# library LibGit2Sharp to add and commit a binary file while it is open by another program. The Repository.Index.RetrieveStatus() call fails with an exception: Error reading file for hashing: The process cannot access the…
wes
  • 1,577
  • 1
  • 14
  • 32
1
vote
1 answer

php: exclusive lock on file never obtained

On my php script, after parse a string, i need to write some data into a file (after create it if doesn't exist). Before write file, i need exclusive lock for avoid problems. This is my code: foreach ($elements[0] as $current) { $file_handler =…
giozh
  • 9,868
  • 30
  • 102
  • 183
1
vote
1 answer

Where is the JVM holding my file lock?

I am dealing with a java.nio.file.AccessDeniedException problem. I have a Scala program where if I do: java.nio.file.Files.delete(FileSystems.getDefault().getPath("""D:\Users\Eric\Google Drive (New)\Music\Downloaded\Foreigner [Discography HQ]\1977 -…
Eric Kolotyluk
  • 1,958
  • 2
  • 21
  • 30
1
vote
1 answer

File gets locked when overwriting

Title explains a small part so let me explain 2 scenarios. Scenario 1 is raising errors, scenario 2 works like a charm. Scenario 1: I checkout a document with the method below, when the document is saved to a location where already is a file with…
ValarmorghulisHQ
  • 989
  • 1
  • 11
  • 31
1
vote
1 answer

DataSet.WriteXml(XmlTextWriter) Leaves XML File Locked

I have a program written in .NET 3.5 which saves data to an XML file, and most of the time will leave it alone after that. However, sometimes it needs to read that XML file back in. When I try to do this, the XML file read fails with the error…
Greg
  • 157
  • 2
  • 14
1
vote
1 answer

Android Java: File seems to be locked after creating/writing

I am .NET developer for many years (10 years) and I am programming android java the first time in my free time. The application I am programming is an app for input data of some course participant. The course instructor inputs some course number…
1
vote
1 answer

How to unlock file locked by pexif

I'm using the PEXIF module to read and edit EXIF data in JPEG files. After reading a file's data I would like to rename the file, but by then it is locked and os.rename() throws a WindowsError. import pexif, os f = 'oldName.jpg' img =…
Fredrik P
  • 682
  • 1
  • 8
  • 21
1
vote
2 answers

In java how can I unlock a file or write to a file opened by excel

I am currently writing a program that outputs to a excel file. (the same open it reads) I have a feeling that the users will open the file in excel before modifying in my application. While I do realize I could save a new file that is not as…
Jegsar
  • 501
  • 6
  • 22
1
vote
0 answers

Locking a file for race conditons perl

I am working on a script for no good reason spawns two extra processes when it run. To combat this i wrote i file lock routine. But because these extra processes are running at the same time this does not seem to work at all. what am i missing here.…
Opad
  • 96
  • 1
  • 5
1
vote
1 answer

file lock leases via NFS v4 in C

does anybody know how to use the fancy file locking features of NFS v4? (described in e.g. About the NFS protocol (scroll down)). supposedly NFS v4 supports file lock leasing with a 45 second lifetime. I would like to believe that the linux kernel…
shabbychef
  • 1,940
  • 3
  • 16
  • 28