------- Comment #16 from redi at gcc dot gnu dot org 2010-09-10 09:55 ------- There certainly is a race condition: there's no ordering between pthread_cancel and pthread_testcancel so the main thread can run f2(50) before thread2 calls pthread_cancel, which is why you see it sometimes run beyond the cancellation point.
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45479