1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-23 17:31:08 +01:00

GitFileSystemObjectSink: Fix crash during interrupt

This commit is contained in:
Eelco Dolstra 2025-12-19 12:06:55 +01:00
parent 97e3816b24
commit 6bea8e0e08
2 changed files with 13 additions and 2 deletions

View file

@ -1094,6 +1094,13 @@ struct GitFileSystemObjectSinkImpl : GitFileSystemObjectSink
{
}
~GitFileSystemObjectSinkImpl()
{
// Make sure the worker threads are destroyed before any state
// they're referring to.
workers.shutdown();
}
struct Child;
/// A directory to be written as a Git tree.

View file

@ -52,6 +52,12 @@ public:
*/
void process();
/**
* Shut down all worker threads and wait until they've exited.
* Active work items are finished, but any pending work items are discarded.
*/
void shutdown();
private:
size_t maxThreads;
@ -72,8 +78,6 @@ private:
std::condition_variable work;
void doWork(bool mainThread);
void shutdown();
};
/**