Browse Source

- locking posix sems bugfix

Andrei Pelinescu-Onciul 23 years ago
parent
commit
c751da147a
3 changed files with 17 additions and 8 deletions
  1. 7 2
      fastlock.h
  2. 6 4
      locking.h
  3. 4 2
      mem/shm_mem.c

+ 7 - 2
fastlock.h

@@ -28,8 +28,13 @@
  * along with this program; if not, write to the Free Software 
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
-
-
+/*
+ *
+ *
+ *  2003-01-16  added PPC locking code contributed by Dinos Dorkofikis
+ *               <[email protected]>
+ *
+ */
 
 
 #ifndef fastlock_h

+ 6 - 4
locking.h

@@ -26,9 +26,11 @@
  */
 
 /*
-    ser locking library
-    - created 16.12.2003 (andrei)
-
+ *   ser locking library
+ *
+ *  2002-12-16 created by andrei
+ *
+ *
 Implements:
 
 	lock_t* lock_alloc();                    - allocates a lock in shared mem.
@@ -100,7 +102,7 @@ typedef sem_t lock_t;
 
 inline static lock_t* lock_init(lock_t* lock)
 {
-	if (sem_init(lock, 0, 1)<0) return 0;
+	if (sem_init(lock, 1, 1)<0) return 0;
 	return lock;
 }
 

+ 4 - 2
mem/shm_mem.c

@@ -264,8 +264,10 @@ void shm_mem_destroy()
 		shm_shmid=-1;
 	}
 #endif
-	if (mem_lock) lock_destroy(mem_lock); /* we don't need to dealloc it*/
-	
+	if (mem_lock){
+		DBG("destroying the shared memory lock\n");
+		lock_destroy(mem_lock); /* we don't need to dealloc it*/
+	}
 }