[IRCServices] out of buffer?

Andrew Church achurch at achurch.org
Tue Jan 25 14:52:08 PST 2005


>Can't you hold an exclusive lock (flock, lockf, etc) on the database while
>writing them and then release it when done writing? That way, the
>`ircservices -export` could try to obtain a shared lock (since it is
>read-only) and it will spin while the DBs are still being written.

     True, but since there are several database files that would mean
having to check/lock several files, which is inconvenient.

     On second thought, Services always creates a lock file (.lock by
default) in the data directory while it's writing, and refuses to write
if the file exists, so you could do something like (in Perl):

	sysopen LOCK, "/.../.lock", O_CREAT|O_EXCL, 0 or die "locked\n";
	system("ircservices -export");
	close LOCK;
	unlink "/.../.lock";

  --Andrew Church
    achurch at achurch.org
    http://achurch.org/