[Assorted-commits] SF.net SVN: assorted:[911] sandbox/trunk/src/py/flocking.py
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-07-30 01:01:26
|
Revision: 911 http://assorted.svn.sourceforge.net/assorted/?rev=911&view=rev Author: yangzhang Date: 2008-07-30 01:01:34 +0000 (Wed, 30 Jul 2008) Log Message: ----------- added flock demo Added Paths: ----------- sandbox/trunk/src/py/flocking.py Added: sandbox/trunk/src/py/flocking.py =================================================================== --- sandbox/trunk/src/py/flocking.py (rev 0) +++ sandbox/trunk/src/py/flocking.py 2008-07-30 01:01:34 UTC (rev 911) @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +# Demo of flock. Try running this concurrently from two shells. + +from __future__ import with_statement +from fcntl import * + +with file('/tmp/mylock', 'w') as f: + print 'locking' + flock(f, LOCK_EX) + print 'locked' + + print 'press enter to continue...' + raw_input() + + print 'unlocking' + flock(f, LOCK_UN) + print 'unlocked' Property changes on: sandbox/trunk/src/py/flocking.py ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |