barrier enhance fix on branch dev

This commit is contained in:
vivek-shankar 2018-07-10 14:03:26 -04:00
parent ecb2aa67fe
commit 0836571c8e
1 changed files with 17 additions and 7 deletions

View File

@ -55,13 +55,7 @@ function barrier_wait(threshold, transf, resumef, bc) {
var allgood = 0
log("--->BS: ", barrier.size(), " / ", threshold, " (", BARRIER_VSTIG, " - ", barrier.get("d"), ") t= ", timeW)
if(barrier.size() - 1 >= threshold or barrier.get("d") == 1) {
var bi = LOWEST_ROBOT_ID
allgood = 1
while (bi<LOWEST_ROBOT_ID+threshold) {
if(barrier.get(bi) != bc)
allgood = 0
bi = bi + 1
}
allgood = barrier_allgood(barrier,bc)
}
if(allgood) {
@ -78,3 +72,19 @@ function barrier_wait(threshold, transf, resumef, bc) {
timeW = timeW+1
}
barriergood = 1
# Barrer check all entries
function barrier_allgood(barrier, bc) {
barriergood = 1
barrier.foreach(
function(key, value, robot){
#log("VS entry : ", key, " ", value, " ", robot)
if(value != bc and key != "d"){
barriergood = 0
}
}
)
return barriergood
}