Recipe 6.13. Locking a File
6.13.1. Problem
You want to prevent other threads or processes from modifying a
file that you're working on.
6.13.2. Solution
Open the file, then lock it with
File#flock. There are two kinds of lock; pass
in the File constant for the kind
you want.
You are currently reading a PREVIEW of this book.
Get instant access to over
$1 million worth of books and videos.
Start a Free Trial