- if (isAlive(t->block_info.closure)) {
- t = (StgTSO *)evacuate((StgClosure *)t);
- if (prev) prev->link = t;
- flag = rtsTrue;
- }
+ // if the closure it is blocked on is either (a) a
+ // reachable BLAKCHOLE or (b) not a BLACKHOLE, then we
+ // make the thread alive.
+ if (!isAlive(t->block_info.closure)) {
+ type = get_itbl(t->block_info.closure)->type;
+ if (type == BLACKHOLE || type == CAF_BLACKHOLE) {
+ continue;
+ }
+ }
+ evacuate((StgClosure **)&t);
+ if (prev) prev->_link = t;
+ // no write barrier when on the blackhole queue,
+ // because we traverse the whole queue on every GC.
+ flag = rtsTrue;