From b6f7f59af18d435e5a9201f67b88b8f989e4cce6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Tue, 17 Oct 2006 11:52:16 +0000 Subject: [PATCH] renamed GetSemID to more convenient JobSemphore now returns true semphore number --- org.glite.lb.server/src/lock.c | 10 +++++----- org.glite.lb.server/src/lock.h | 2 +- org.glite.lb.server/src/process_event.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/org.glite.lb.server/src/lock.c b/org.glite.lb.server/src/lock.c index b4cd987..27a8ec1 100644 --- a/org.glite.lb.server/src/lock.c +++ b/org.glite.lb.server/src/lock.c @@ -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; diff --git a/org.glite.lb.server/src/lock.h b/org.glite.lb.server/src/lock.h index 85bb875..b330177 100644 --- a/org.glite.lb.server/src/lock.h +++ b/org.glite.lb.server/src/lock.h @@ -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); diff --git a/org.glite.lb.server/src/process_event.c b/org.glite.lb.server/src/process_event.c index 3445332..be043ea 100644 --- a/org.glite.lb.server/src/process_event.c +++ b/org.glite.lb.server/src/process_event.c @@ -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; -- 1.8.2.3