Add a 'print "waiting\n"' before the 'last' statement.
I would expect the 'cond_timedwait' statement to return after 5 seconds and loop over the 'print ..' statement 5-6 times before the 'test' thread returned. Instead I see the 'test' thread start and block the loop until 'test' finishes.
Am I completely misunderstanding how this process works?