Problem with fork join_any and disable fork

In reply to m_v:

This is a race condition. The only guaranteed output is that if printed, “a=0…a=9” must be in order, and that the "after disable must be the last output line. So technically the following is another valid output

0 a = 0

0 a = 1

0 a = 2

0 a = 3

0 before disable

0 a = 4

0 a = 5

0 a = 6

0 after disable