From cc1340671b0c719e0393cdeae5f1813635b19aa0 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Wed, 26 Mar 2008 14:47:54 +0100 Subject: Fixed shm so it does not rely on the lowlevel shm module being existant during shutdown --- _shm/shm_wrapper.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to '_shm') 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 -- cgit v1.2.3-70-g09d2 >root/filters (unfollow)
Commit message (Expand)AuthorFilesLines
2013-04-07ui-blob: don't segfault when no path is givenJohn Keeping1-1/+1
2013-03-20Convert pager navigation into a unordered listLukas Fleischer3-9/+20
2013-03-20Makefile: remove CGIT-CFLAGS files in clean stageJason A. Donenfeld1-1/+1
2013-03-20ui-summary.c: Move urls variable into print_urls()Lukas Fleischer1-6/+14
2013-03-20Fix colspan valuesLukas Fleischer3-14/+28
2013-03-20html: check return value of writeJason A. Donenfeld1-2/+3
2013-03-20ui-shared: squelch compiler warning.Jason A. Donenfeld1-0/+1
2013-03-20cgit.mk: Use SHELL_PATH_SQ to run gen-version.shJohn Keeping1-1/+1
2013-03-20cgit.mk: don't rebuild everything if CGIT_VERSION changesJohn Keeping1-1/+8
2013-03-20ui-patch: use cgit_version not CGIT_VERSIONJohn Keeping1-1/+1
2013-03-20Makefile: re-use Git's Makefile where possibleJohn Keeping3-119/+80