The trap mechanism works as follows. When a thread calling this
OnCall method and it is chosen by the
set_trap will register the current method call to some global table, and the thread will sleep for some period(e.g., 100ms). During this period, every other thread entering
OnCall checks if it conflicts with the currently registered traps. If two traps conflicts and at least one operation is a write, TSVD find a bug. Notice that such delay-based strategy will guarantee that if a violation is found, this is a true bug(i.e., no false positives).