]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
removed signal blocking from TRB3 design, not needed anymore
authorhadaq <hadaq>
Fri, 20 Jul 2012 16:03:16 +0000 (16:03 +0000)
committerhadaq <hadaq>
Fri, 20 Jul 2012 16:03:16 +0000 (16:03 +0000)
libtrbnet/trbnet.c

index 83fa01704f5d0c28fea2f0ba8470caaa85b0a331..9cf9d3caec1d9ce1211910053e3bddadf1bda460 100644 (file)
@@ -1,11 +1,11 @@
 #ifdef ETRAX
-const char trbnet_version[] = "$Revision: 4.40 $  Local Etrax";
+const char trbnet_version[] = "$Revision: 4.41 $  Local Etrax";
 #elif defined PEXOR
-const char trbnet_version[] = "$Revision: 4.40 $  Local Pexor";
+const char trbnet_version[] = "$Revision: 4.41 $  Local Pexor";
 #elif defined TRB3
-const char trbnet_version[] = "$Revision: 4.40 $  Local TRB3";
+const char trbnet_version[] = "$Revision: 4.41 $  Local TRB3";
 #else
-const char trbnet_version[] = "$Revision: 4.40 $  UNKNOWN, i.e. ERROR";
+const char trbnet_version[] = "$Revision: 4.41 $  UNKNOWN, i.e. ERROR";
 #endif
 
 #include <stdlib.h>
@@ -175,14 +175,16 @@ uint16_t sender_address = 0x5555;
 
 /* ---------------------------------------------------------------------- */
 
+#ifndef TRB3 
+
 /* Used for blocking Signals */
 static sigset_t blockSet;
 static sigset_t blockSetOld;
 
 /* Semaphore handling */
 static int semid = -1;
-#ifndef TRB3 
 static const key_t sem_key = 0x545242;
+
 #endif
 
 unsigned int trb_debug = 0;
@@ -1385,19 +1387,17 @@ static int lockPorts(int masterLock)
     -1,          /* sem_op: decrement semaphore by 1, i.e. lock it        */
     SEM_UNDO     /* sem_flg: remove lock if process gets killed           */
   };
-
+  
   if ((master_lock == 1) && (masterLock == 0)) {
     return 0;
   }
-#endif
-
+  
   /* Block Signals */
   if (sigprocmask(SIG_BLOCK, &blockSet, &blockSetOld) == -1) {
     trb_errno = TRB_SEMAPHORE;
     return -1;
   }
 
-#ifndef TRB3
   /* Wait for semaphore and lock it */
   if (semop(semid, &sops, 1) == -1) {
     /* Unblock signals */
@@ -1413,7 +1413,7 @@ static int lockPorts(int masterLock)
 #endif
 
   if (masterLock != 0) master_lock = 1;
-
+  
   return 0;
 }
 
@@ -1426,7 +1426,7 @@ static int unlockPorts(int masterLock)
     SEM_UNDO        /* sem_flg: remove lock if process gets killed       */
   };
 #endif
-
+  
   if ((master_lock == 1) && (masterLock == 0)) {
     return 0;
   }
@@ -1439,13 +1439,13 @@ static int unlockPorts(int masterLock)
     trb_errno = TRB_SEMAPHORE;
     return -1;
   }
-#endif
 
   /* Unblock Signals */
   if (sigprocmask(SIG_SETMASK, &blockSetOld, NULL) == -1) {
     trb_errno = TRB_SEMAPHORE;
     return -1;
   }
+#endif
 
   return 0;
 }
@@ -1453,14 +1453,14 @@ static int unlockPorts(int masterLock)
 
 static int init_semaphore()
 {
-  /* Set signal mask to block ALL signals */
-  sigfillset(&blockSet);
-  sigemptyset(&blockSetOld);
-  
 #ifdef TRB3
   return 0;
 #else
 
+  /* Set signal mask to block ALL signals */
+  sigfillset(&blockSet);
+  sigemptyset(&blockSetOld);
+
   /* Get / Create semaphore */
   if ((semid = semget(sem_key, 1,
                       IPC_CREAT | IPC_EXCL |