rem: s_unlock_at(jwl->sems, pos);
add: lock_set_release(jwl->sems, pos);
context: int xj_wlist_get(xj_wlist jwl, xj_jkey jkey, xj_jkey *p){	int i = 0, pos = -1, min = 100000;	xj_jkey msid = NULL;		if(jwl==NULL || jkey==NULL || jkey->id==NULL || jkey->id->s==NULL)		return -1;	*p = NULL;	while(i < jwl->len)	{		s_lock_at(jwl->sems, i);		if(jwl->workers[i].pid <= 0)		{			s_unlock_at(jwl->sems, i);			i++;			continue;		}		if((*p = find234(jwl->workers[i].sip_ids, (void*)jkey, NULL))!=NULL)		{			if(pos >= 0)				s_unlock_at(jwl->sems, pos);			s_unlock_at(jwl->sems, i);#ifdef XJ_EXTRA_DEBUG			DBG("XJAB:xj_wlist_get: entry already exists for <%.*s> in the"				" pool of <%d> [%d]\n",jkey->id->len, jkey->id->s,				jwl->workers[i].pid,i);#endif			return jwl->workers[i].wpipe;		}		if(min > jwl->workers[i].nr)		{			if(pos >= 0)				s_unlock_at(jwl->sems, pos);			pos = i;			min = jwl->workers[i].nr;		}		else			s_unlock_at(jwl->sems, i);		i++;	}	if(pos >= 0 && jwl->workers[pos].nr < jwl->maxj)	{		jwl->workers[pos].nr++;		msid = (xj_jkey)_M_SHM_MALLOC(sizeof(t_xj_jkey));		if(msid == NULL)			goto error;		msid->id = (str*)_M_SHM_MALLOC(sizeof(str));		if(msid->id == NULL)		{			_M_SHM_FREE(msid);			goto error;		}				msid->id->s = (char*)_M_SHM_MALLOC(jkey->id->len);		if(msid->id == NULL)		{			_M_SHM_FREE(msid->id);			_M_SHM_FREE(msid);			goto error;		}				if((*p = add234(jwl->workers[pos].sip_ids, msid)) != NULL)		{			msid->id->len = jkey->id->len;			memcpy(msid->id->s, jkey->id->s, jkey->id->len);			msid->hash = jkey->hash;			msid->flag = XJ_FLAG_OPEN;			s_unlock_at(jwl->sems, pos);#ifdef XJ_EXTRA_DEBUG			DBG("XJAB:xj_wlist_get: new entry for <%.*s> in the pool of"				" <%d> - [%d]\n", jkey->id->len, jkey->id->s,				jwl->workers[pos].pid, pos);#endif			return jwl->workers[pos].wpipe;		}		_M_SHM_FREE(msid->id->s);		_M_SHM_FREE(msid->id);		_M_SHM_FREE(msid);	}error:	if(pos >= 0)		s_unlock_at(jwl->sems, pos);	DBG("XJAB:xj_wlist_get: cannot create a new entry for <%.*s>\n",				jkey->id->len, jkey->id->s);	return -1;}