Skip to content

[compiler-rt][profile] Use flock shim on Windows even if detection fails #112695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions compiler-rt/lib/profile/InstrProfilingUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ COMPILER_RT_VISIBILITY int lprofLockFd(int fd) {
}
}
return 0;
#elif defined(COMPILER_RT_HAS_FLOCK)
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
// Windows doesn't have flock but WindowsMMap.h provides a shim
flock(fd, LOCK_EX);
return 0;
#else
Expand All @@ -179,7 +180,8 @@ COMPILER_RT_VISIBILITY int lprofUnlockFd(int fd) {
}
}
return 0;
#elif defined(COMPILER_RT_HAS_FLOCK)
#elif defined(COMPILER_RT_HAS_FLOCK) || defined(_WIN32)
// Windows doesn't have flock but WindowsMMap.h provides a shim
flock(fd, LOCK_UN);
return 0;
#else
Expand Down
Loading