The concept of locking a file to serialize concurrent accesses to said file.
Questions tagged [file-locking]
372 questions
4
votes
2 answers
how to implement the folder lock in java
i want lock the particular folder, and i have code but the "java.io.FileNotFoundException: (Access is denied)" error is found
public class Folder_Lock {
public static void main(String[] args) {
FileLock lock = null;
FileChannel channel…

mani
- 155
- 3
- 7
- 15
4
votes
2 answers
What is the order in which a POSIX system clears the file locks that were not unlocked cleanly?
The POSIX specification for fcntl() states:
All locks associated with a file for a given process shall be removed when a file descriptor for that file is closed by that process or the process holding that file descriptor terminates.
Is this…

Daniel Trebbien
- 38,421
- 18
- 121
- 193
4
votes
8 answers
Log File Monitor
Is is possible to open a text file and read the contents while another application is updating the file, in such a way that it does not cause a lock conflict?
I need to monitor a log file from one application which is updated by another application…

Pieter van Wyk
- 2,316
- 9
- 48
- 65
4
votes
2 answers
How to synchronize between multiple async processes in Python?
I have an async http webs service using fastapi. I am running multiple instances of the same service on the server on a different port and I have an nginx server in front so I can utilise them all. I have a particular resource I need to protect that…

Bob Fang
- 6,963
- 10
- 39
- 72
4
votes
3 answers
Is there a way to create a file that is locked at the point of creation, in Perl?
I need to create a file that is locked against reads, at the point of creation, so that other processes that may go looking for this file do not start reading it, before it has been completely written.
I know that I can create and then lock it, but…

Dancrumb
- 26,597
- 10
- 74
- 130
4
votes
6 answers
TFS won't allow folder rename, claims that there are locks
In visual studio 2008, I want to rename a folder due to a typo in the name.
I rename it in the solution structure. The folder and .CSProj files are now checked out, and I check in.
TFS comes back with "Microsoft Visual studio cannot perform the…

Anthony
- 5,176
- 6
- 65
- 87
4
votes
1 answer
How to get a process exclusive lock on a folder in Windows?
Is it possible to lock a directory in Windows so as to ensure that no other process is reading or modifying files inside the directory for the duration of the lock, while at the same time allowing the process with the lock to modify and move files…

Ziphnor
- 1,022
- 1
- 8
- 17
4
votes
1 answer
Delete consecutive duplicates: "File sharing lock count exceeded" at 9k of 1m records
I need to remove consecutive duplicate records from a large table (It could contain 200k-1 million records, and about half the records will be deleted).
DateTime is unique. Records where the remaining fields match the previous record, should be…

ashleedawg
- 20,365
- 9
- 72
- 105
4
votes
2 answers
Reading file right after it has been written I get all zeros (.net)
I have a program that needs to load files from a directory as soon as they are written. I got the FileSystemWatcher to notify me of changes to the directory. Rather than check the event for what changed I just list the files and start processing…

TomU
- 95
- 6
4
votes
1 answer
File locks support in Docker volumes of NFS4 shares
Here is an excerpt from my docker-compose.yml file:
volumes:
nfs_share:
driver: local
driver_opts:
type: nfs
o: addr=nfs_server,rw,noatime
device: ":/srv/nfs_share"
The volume is correctly mounted on the host.
However,…

alexpirine
- 3,023
- 1
- 26
- 41
4
votes
1 answer
How to pass a manager object to a process
I am trying to pass a the whole of a manger object to a process, but I am unable to do so. When I try to I get this error:
Traceback (most recent call last):
File "TwitchMarketDatabase.py", line 46, in
…

Ryan Schaefer
- 3,047
- 1
- 26
- 46
4
votes
1 answer
VB6 IDE Is Locking The Loaded Project's DLL
I'm responsible for maintaining legacy VB6 code, and have encountered an annoying problem with regard to the locking of a project's COM DLL. (We'll call it MyProject and MyProject.dll)
When I load MyProject into the VB6 IDE, I am able to compile the…

James Wiseman
- 29,946
- 17
- 95
- 158
4
votes
0 answers
dnx holding locks on files IIS - unable to copy over
We have an ASPNet5 site (angular site and webapi service) running under IIS 8.5 successfully. The issue we have now run into is dnx holding locks on files that prevent us from re-deploying the site from our automated deployment server. The task is…

jd314159
- 365
- 2
- 14
4
votes
2 answers
Powershell - Check if file is finished writing
I have a powershell code that acts as a file listener on a given folder path. The listener kicks off a command line call to another program that opens and plays with the file.
The problem is that the powershell code Immediately kicks off the…

Anotherdream
- 81
- 1
- 4
4
votes
3 answers
Is std::ifstream thread-safe & lock-free?
I intend to perform opening for reading a single file from many threads using std::ifstream. My concern is if std::ifstream is thread-safe & lock-free?
More details:
I use g++ 4.4 on Ubuntu & Windows XP, 4.0 on Leopard.
Each thread creates its own…

Viet
- 17,944
- 33
- 103
- 135