Browse code

- locking posix sems bugfix

Andrei Pelinescu-Onciul authored on 17/01/2003 16:24:51
Showing 3 changed files
... ...
@@ -28,8 +28,13 @@
28 28
  * along with this program; if not, write to the Free Software 
29 29
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
30 30
  */
31
-
32
-
31
+/*
32
+ *
33
+ *
34
+ *  2003-01-16  added PPC locking code contributed by Dinos Dorkofikis
35
+ *               <kdor@intranet.gr>
36
+ *
37
+ */
33 38
 
34 39
 
35 40
 #ifndef fastlock_h
... ...
@@ -26,9 +26,11 @@
26 26
  */
27 27
 
28 28
 /*
29
-    ser locking library
30
-    - created 16.12.2003 (andrei)
31
-
29
+ *   ser locking library
30
+ *
31
+ *  2002-12-16 created by andrei
32
+ *
33
+ *
32 34
 Implements:
33 35
 
34 36
 	lock_t* lock_alloc();                    - allocates a lock in shared mem.
... ...
@@ -100,7 +102,7 @@ typedef sem_t lock_t;
100 100
 
101 101
 inline static lock_t* lock_init(lock_t* lock)
102 102
 {
103
-	if (sem_init(lock, 0, 1)<0) return 0;
103
+	if (sem_init(lock, 1, 1)<0) return 0;
104 104
 	return lock;
105 105
 }
106 106
 
... ...
@@ -264,8 +264,10 @@ void shm_mem_destroy()
264 264
 		shm_shmid=-1;
265 265
 	}
266 266
 #endif
267
-	if (mem_lock) lock_destroy(mem_lock); /* we don't need to dealloc it*/
268
-	
267
+	if (mem_lock){
268
+		DBG("destroying the shared memory lock\n");
269
+		lock_destroy(mem_lock); /* we don't need to dealloc it*/
270
+	}
269 271
 }
270 272
 
271 273