repo.or.cz
/
python
/
dscho.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git]
/
Lib
/
lib-old
/
lockfile.py
blob
3a251d720b09d0b8c6d4fe63f1aae928c4c57a5e
1
import
struct
,
fcntl
,
FCNTL
2
3
def
writelock
(
f
):
4
_lock
(
f
,
FCNTL
.
F_WRLCK
)
5
6
def
readlock
(
f
):
7
_lock
(
f
,
FCNTL
.
F_RDLCK
)
8
9
def
unlock
(
f
):
10
_lock
(
f
,
FCNTL
.
F_UNLCK
)
11
12
def
_lock
(
f
,
op
):
13
dummy
=
fcntl
.
fcntl
(
f
.
fileno
(),
FCNTL
.
F_SETLKW
,
14
struct
.
pack
(
'2h8l'
,
op
,
15
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
))