js_lock(3)

NAME
js_lock - Place an exclusive lock on an open file

SYNOPSIS
#include JsStr.h

int js_lock(js_file *desc)

DESCRIPTION
js_lock is a function that places an exclusive lock on an open file. If the file is already locked, then this function will wait until the file is unlocked before locking the file. Note that the amount of time this funciton will take to run is undetermined.

ARGUMENTS
desc is a pointer to an open file object.

RETURN VALUE
js_lock returns JS_SUCCESS.

NOTES
js_lock uses flock to lock the file.

EXAMPLE
The following locks the file "filename":
	js_string *foo;
	js_file *bar;
	foo = js_create(256,1);
	js_str2js(foo,"filename",8,1);
	js_open_write(foo,bar);
	js_lock(bar);

AUTHOR
Sam Trenholme <kiwi-zttfryb@koala.samiam.org>