use a_store to set cancel flag in pthread_cancel, to ensure a barrier