diff options
author | Rui Ueyama <ruiu@google.com> | 2017-10-05 23:01:11 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2017-10-05 23:01:11 +0000 |
commit | 945cd644714611279791def24808be74ef87f86f (patch) | |
tree | 0622d031cb905aa85ec151d314a0b21b0e234390 /lldb/packages/Python/lldbsuite/test/source-manager/main.c | |
parent | 27e66fb5794c10e12f04613b2a76bfedc6f6936e (diff) | |
download | bcm5719-llvm-945cd644714611279791def24808be74ef87f86f.tar.gz bcm5719-llvm-945cd644714611279791def24808be74ef87f86f.zip |
Wait for all threads to terminate before exitting.
I think it is not defined what would happen to detached threads
when the main thread tries to exit. That means it was not guaranteed
that unlinkAsync correctly removes a temporary file. It was also
reported that this unlinkAsync caused a crash on Windows.
This patch adds a few new functions so that the main thread always
waits for non-main threads before exitting.
I don't actually like the new two functions, runBackground and
waitForBackgroundThreads, because it looks like it is a bit
overdesigned. After all, what we are doing with these functions
is to just remove a file.
An alternative would be to do fork(2) and make the child process
remove a file asynchronously. However, it has its own problems.
Correctly forking and reclaiming a resource using waitpid(2) is not
doable unless we know our process-wide settings (such as signal mask),
but we can't make any assumption on it when lld is embedded to other
process. So I chose to stick with threads instead of multi-processes.
Differential Revision: https://reviews.llvm.org/D38571
llvm-svn: 315033
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/source-manager/main.c')
0 files changed, 0 insertions, 0 deletions