My gut instinct would be to add an additional condition (a timer) to that while loop.
I don't work with that processor so I am not sure of the implementation but here's my pseudo code:
while ( (pcb != NULL) && (thisTimer <= ARBITRARY_MAX_WAIT_TIME) ) {
...
}
I don't know if that makes any sense to do it that way, but that is how I am thinking. Add in a second variable that *you* have control over. Then you can have a measure of sanity of something goes off the rails.
YMMV