5 Mar 2009 (Thu)

12:23:44 # Life file locking basics. I was looking at how to lock a file. flock(2) system call allows locking a file with LOCK_EX and LOCK_SH; if used properly, parallel processing can be serialized. It is also possible to use 'flock' from shell scripts. I found the design of 'flock fd' variant clever, and nonobvious. It's possible to assign arbitrary file to arbitrary fd number in shell, and effect of flock lasts as long as the fd is open. Interesting.

Junichi Uekawa

$Id: dancer-diary.el,v 1.93 2009/01/04 03:42:29 dancer Exp $