Revision ec44d893 lib/locking.py
b/lib/locking.py | ||
---|---|---|
600 | 600 |
def acquire(self, shared=0, timeout=None, test_notify=None): |
601 | 601 |
"""Acquire a shared lock. |
602 | 602 |
|
603 |
@type shared: int |
|
603 |
@type shared: integer (0/1) used as a boolean
|
|
604 | 604 |
@param shared: whether to acquire in shared mode; by default an |
605 | 605 |
exclusive lock will be acquired |
606 | 606 |
@type timeout: float |
... | ... | |
713 | 713 |
def __init__(self, members=None): |
714 | 714 |
"""Constructs a new LockSet. |
715 | 715 |
|
716 |
@type members: list of strings |
|
716 | 717 |
@param members: initial members of the set |
717 | 718 |
|
718 | 719 |
""" |
... | ... | |
811 | 812 |
def acquire(self, names, timeout=None, shared=0, test_notify=None): |
812 | 813 |
"""Acquire a set of resource locks. |
813 | 814 |
|
815 |
@type names: list of strings (or string) |
|
814 | 816 |
@param names: the names of the locks which shall be acquired |
815 | 817 |
(special lock names, or instance/node names) |
818 |
@type shared: integer (0/1) used as a boolean |
|
816 | 819 |
@param shared: whether to acquire in shared mode; by default an |
817 | 820 |
exclusive lock will be acquired |
818 | 821 |
@type timeout: float or None |
... | ... | |
968 | 971 |
You must have acquired the locks, either in shared or in exclusive mode, |
969 | 972 |
before releasing them. |
970 | 973 |
|
974 |
@type names: list of strings, or None |
|
971 | 975 |
@param names: the names of the locks which shall be released |
972 | 976 |
(defaults to all the locks acquired at that level). |
973 | 977 |
|
... | ... | |
1001 | 1005 |
def add(self, names, acquired=0, shared=0): |
1002 | 1006 |
"""Add a new set of elements to the set |
1003 | 1007 |
|
1008 |
@type names: list of strings |
|
1004 | 1009 |
@param names: names of the new elements to add |
1010 |
@type acquired: integer (0/1) used as a boolean |
|
1005 | 1011 |
@param acquired: pre-acquire the new resource? |
1012 |
@type shared: integer (0/1) used as a boolean |
|
1006 | 1013 |
@param shared: is the pre-acquisition shared? |
1007 | 1014 |
|
1008 | 1015 |
""" |
... | ... | |
1062 | 1069 |
You can either not hold anything in the lockset or already hold a superset |
1063 | 1070 |
of the elements you want to delete, exclusively. |
1064 | 1071 |
|
1072 |
@type names: list of strings |
|
1065 | 1073 |
@param names: names of the resource to remove. |
1066 | 1074 |
|
1067 | 1075 |
@return: a list of locks which we removed; the list is always |
... | ... | |
1227 | 1235 |
def acquire(self, level, names, timeout=None, shared=0): |
1228 | 1236 |
"""Acquire a set of resource locks, at the same level. |
1229 | 1237 |
|
1230 |
@param level: the level at which the locks shall be acquired; |
|
1231 |
it must be a member of LEVELS. |
|
1238 |
@type level: member of locking.LEVELS |
|
1239 |
@param level: the level at which the locks shall be acquired |
|
1240 |
@type names: list of strings (or string) |
|
1232 | 1241 |
@param names: the names of the locks which shall be acquired |
1233 | 1242 |
(special lock names, or instance/node names) |
1243 |
@type shared: integer (0/1) used as a boolean |
|
1234 | 1244 |
@param shared: whether to acquire in shared mode; by default |
1235 | 1245 |
an exclusive lock will be acquired |
1236 | 1246 |
@type timeout: float |
... | ... | |
1261 | 1271 |
You must have acquired the locks, either in shared or in exclusive |
1262 | 1272 |
mode, before releasing them. |
1263 | 1273 |
|
1264 |
@param level: the level at which the locks shall be released; |
|
1265 |
it must be a member of LEVELS |
|
1274 |
@type level: member of locking.LEVELS |
|
1275 |
@param level: the level at which the locks shall be released |
|
1276 |
@type names: list of strings, or None |
|
1266 | 1277 |
@param names: the names of the locks which shall be released |
1267 | 1278 |
(defaults to all the locks acquired at that level) |
1268 | 1279 |
|
... | ... | |
1281 | 1292 |
def add(self, level, names, acquired=0, shared=0): |
1282 | 1293 |
"""Add locks at the specified level. |
1283 | 1294 |
|
1284 |
@param level: the level at which the locks shall be added; |
|
1285 |
it must be a member of LEVELS_MOD. |
|
1295 |
@type level: member of locking.LEVELS_MOD |
|
1296 |
@param level: the level at which the locks shall be added |
|
1297 |
@type names: list of strings |
|
1286 | 1298 |
@param names: names of the locks to acquire |
1299 |
@type acquired: integer (0/1) used as a boolean |
|
1287 | 1300 |
@param acquired: whether to acquire the newly added locks |
1301 |
@type shared: integer (0/1) used as a boolean |
|
1288 | 1302 |
@param shared: whether the acquisition will be shared |
1289 | 1303 |
|
1290 | 1304 |
""" |
... | ... | |
1301 | 1315 |
You must either already own the locks you are trying to remove |
1302 | 1316 |
exclusively or not own any lock at an upper level. |
1303 | 1317 |
|
1304 |
@param level: the level at which the locks shall be removed; |
|
1305 |
it must be a member of LEVELS_MOD |
|
1318 |
@type level: member of locking.LEVELS_MOD |
|
1319 |
@param level: the level at which the locks shall be removed |
|
1320 |
@type names: list of strings |
|
1306 | 1321 |
@param names: the names of the locks which shall be removed |
1307 | 1322 |
(special lock names, or instance/node names) |
1308 | 1323 |
|
Also available in: Unified diff