Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

metal: serve ends cleanly after QUIT (Metal-only _Exit)

Niko1221b66c61984bb7
diff --git a/src/program/generate.cpp b/src/program/generate.cpp
index 9128f368d..05dc61a68 100644
--- a/src/program/generate.cpp
+++ b/src/program/generate.cpp
@@ -12537,6 +12537,13 @@ int main(int argc, char** argv) {
}
}
save_profile("exit"); // #477: QUIT, or the server closed stdin
+#if defined(STRATA_GPU_METAL)
+ // the stdin reader (detached above) may still take in_mu when the server closes the pipe after QUIT; on macOS
+ // locking that mutex once this scope has destroyed it throws (the engine ended with an abort): end here
+ std::fflush(stdout);
+ std::fflush(stderr);
+ std::_Exit(0);
+#endif
return 0;
}