0% found this document useful (0 votes)
48 views1 page

Assignment 2 Answer

Uploaded by

beter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views1 page

Assignment 2 Answer

Uploaded by

beter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

semaphore

semaphore
semaphore
semaphore

south=1;
north=1;
count_south=0;
count_north=0;

startToNorth{
if count_south != 0 down(south);
if count_north == 0 down(north); // lock bridge
startCross();
up(count_north);
}
endToNorth{
down(count_north);
endCros();
if count_north == 0 up(north)
}
startToSouth{
if count_north != 0 down(north)
if count_south == 0 down(south) // lock bridge
startCross()
up(count_south)
}
endToSouth{
down(count_north)
endCros()
if count_south ==0 up(south);
}

You might also like