===== SHELL =====
LOCK="/var/lock/${0##*/}.lck"
function sys_create_lock
{
(ps -p $(readlink "${LOCK}")) &>/dev/null
[ "$?" != "0" ] && rm -f "${LOCK}"
ln -s $$ "${LOCK}" 2>/dev/null
res="$?"
[ "${res}" != "0" ] && exit "${res}"
trap sys_remove_lock EXIT
}
function sys_remove_lock
{
[ "$(readlink "${LOCK}")" == "$$" ] && rm -f "${LOCK}"
}
==== MISC ====
* [[java]] [[synchronized]] : http://www.java2s.com/Code/Java/Threads/Threadnotify.htm
http://download.oracle.com/javase/tutorial/essential/concurrency/locksync.html
tutos : http://download.oracle.com/javase/tutorial/index.html
in french doc sur synchronized: : http://www.lifl.fr/~bogaert/clfc/polyDurif/node83.html
in french doc sur wait: http://www.lifl.fr/~bogaert/clfc/polyDurif/node84.html
http://download.oracle.com/javase/tutorial/essential/concurrency/guardmeth.html
===== MORE =====
@related: [[bash]] [[arpalhands]] [[sync]] UnLock
@TaG: SynC CooP BaSh
{{http://web.archive.org/web/20080527104432/http://xport.xbox-scene.com/screens_winuaex/3.png}}