ThreadTid and FindThreadByUid should be free of side effects.
Before this commit two consecutive calls to ThreadTid (with the same
arguments) would return different results.
Differential D72115
[TSan] Remove side effects from ThreadTid yln on Jan 2 2020, 3:41 PM. Authored by
Details
ThreadTid and FindThreadByUid should be free of side effects. Before this commit two consecutive calls to ThreadTid (with the same
Diff Detail
Event TimelineComment Actions Is this an oversight or on purpose? Comment Actions If I add a second, dummy call to ThreadTid in one of the places where it is used (e.g., pthread_join interceptor) many tests start to fail. Comment Actions Hi Julian, Why ThreadTid and FindThreadByUid should be free of side effects? What is the problem you are trying to solve? Comment Actions Thanks for pointing this out, Dmitry! I have found your explanation:
I am trying to look up a thread by its user_id (pthread_t). More context: Comment Actions You may need another function, or add a consume_uid flag to the current one. But if you will do any changes in this area, please add some comment here as to why we reset user_id, it's indeed tricky. |