diff options
author | René 'Necoro' Neumann <necoro@necoro.net> | 2008-03-26 14:47:54 +0100 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.net> | 2008-03-26 14:47:54 +0100 |
commit | cc1340671b0c719e0393cdeae5f1813635b19aa0 (patch) | |
tree | 4421c63999631794941f032767b293f48c176ad8 /_shm | |
parent | d8bf0f12b39f052055da0108e5f87fb82f1b2eb3 (diff) | |
download | portato-cc1340671b0c719e0393cdeae5f1813635b19aa0.tar.gz portato-cc1340671b0c719e0393cdeae5f1813635b19aa0.tar.bz2 portato-cc1340671b0c719e0393cdeae5f1813635b19aa0.zip |
Fixed shm so it does not rely on the lowlevel shm module being existant during shutdown
Diffstat (limited to '')
-rw-r--r-- | _shm/shm_wrapper.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/_shm/shm_wrapper.py b/_shm/shm_wrapper.py index bf29f65..851f588 100644 --- a/_shm/shm_wrapper.py +++ b/_shm/shm_wrapper.py @@ -24,6 +24,7 @@ import sys # Third party modules import shm +from shm import error as shmerror r"""shm_wrapper - A wrapper for the shm module which provides access to System V shared memory and semaphores on *nix systems. @@ -49,7 +50,7 @@ def create_memory(size, permissions = 0666, InitCharacter = ' '): key = random.randint(1, sys.maxint - 1) try: memory = shm.create_memory(key, size, permissions) - except shm.error, ExtraData: + except shmerror, ExtraData: if shm.memory_haskey(key): # Oops, bad luck, the key exists. I'll try another. I can't call # memory_haskey() before calling create_memory() because that would create @@ -59,7 +60,7 @@ def create_memory(size, permissions = 0666, InitCharacter = ' '): pass else: # Uh-oh, something fundamental is wrong. - raise shm.error, ExtraData + raise shmerror, ExtraData # Here I implicitly discard the memory handle object returned to me by shm and instead # return my own handle to the shared memory segment. @@ -90,7 +91,7 @@ class SharedMemoryHandle(object): try: if self._MemoryHandle.attached: self._MemoryHandle.detach() - except shm.error: + except shmerror: pass @@ -187,7 +188,7 @@ def create_semaphore(InitialValue = 1, permissions = 0666): key = random.randint(1, sys.maxint - 1) try: semaphore = shm.create_semaphore(key, InitialValue, permissions) - except shm.error, ExtraData: + except shmerror, ExtraData: if shm.semaphore_haskey(key): # Oops, bad luck, the key exists. I'll try another. I can't call # memory_haskey() before calling create_semaphore() because that would create |