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;
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)
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;
#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);
{
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;