renamed GetSemID to more convenient JobSemphore
authorMiloš Mulač <mulac@civ.zcu.cz>
Tue, 17 Oct 2006 11:52:16 +0000 (11:52 +0000)
committerMiloš Mulač <mulac@civ.zcu.cz>
Tue, 17 Oct 2006 11:52:16 +0000 (11:52 +0000)
now returns true semphore number

org.glite.lb.server/src/lock.c
org.glite.lb.server/src/lock.h
org.glite.lb.server/src/process_event.c

index b4cd987..27a8ec1 100644 (file)
@@ -11,7 +11,7 @@
 
 extern int debug;
 
-int edg_wll_GetSemID(const edg_wll_Context ctx, const edg_wlc_JobId job)
+int edg_wll_JobSemaphore(const edg_wll_Context ctx, const edg_wlc_JobId job)
 {
        char    *un = edg_wlc_JobIdGetUnique(job);
        int     n,i;
@@ -28,7 +28,7 @@ int edg_wll_GetSemID(const edg_wll_Context ctx, const edg_wlc_JobId job)
        n += i<<6;
 
        free(un);
-       return(n);
+       return(n % ctx->semaphores);
 }
 
 int edg_wll_LockUnlockJob(const edg_wll_Context ctx,const edg_wlc_JobId job,int lock)
@@ -37,11 +37,11 @@ int edg_wll_LockUnlockJob(const edg_wll_Context ctx,const edg_wlc_JobId job,int
        int             n;
 
                
-       if ((n=edg_wll_GetSemID(ctx, job)) == -1) return edg_wll_Error(ctx,NULL,NULL);
+       if ((n=edg_wll_JobSemaphore(ctx, job)) == -1) return edg_wll_Error(ctx,NULL,NULL);
 
-       if (debug) fprintf(stderr,"[%d] semop(%d,%d) \n",getpid(),n % ctx->semaphores,lock);
+       if (debug) fprintf(stderr,"[%d] semop(%d,%d) \n",getpid(),n,lock);
 
-       s.sem_num = n % ctx->semaphores;
+       s.sem_num = n;
        s.sem_op = lock;
        s.sem_flg = SEM_UNDO;
 
index 85bb875..b330177 100644 (file)
@@ -2,4 +2,4 @@
 #define edg_wll_UnlockJob(ctx,job) edg_wll_LockUnlockJob((ctx),(job),1)
 
 int edg_wll_LockUnlockJob(const edg_wll_Context,const edg_wlc_JobId,int);
-int edg_wll_GetSemID(const edg_wll_Context ctx, const edg_wlc_JobId job);
+int edg_wll_JobSemaphore(const edg_wll_Context ctx, const edg_wlc_JobId job);
index 3445332..be043ea 100644 (file)
@@ -214,8 +214,8 @@ static int dependent_parent_lock(edg_wll_Context ctx, edg_wlc_JobId p,edg_wlc_Jo
 {
        int     p_id, c_id;
 
-       if ((p_id=edg_wll_GetSemID(ctx, p)) == -1) return -1;
-       if ((c_id=edg_wll_GetSemID(ctx, c)) == -1) return -1;
+       if ((p_id=edg_wll_JobSemaphore(ctx, p)) == -1) return -1;
+       if ((c_id=edg_wll_JobSemaphore(ctx, c)) == -1) return -1;
 
        if (p_id == c_id) return 1;
        else return 0;