Skip to content

Distribute and run LLMs with a single file.

Handle CTRL-C better on MacOS

Justine Tunneyb0b46136ca4e
diff --git a/llama.cpp/main/main.cpp b/llama.cpp/main/main.cpp
index 12fbca74..92609978 100644
--- a/llama.cpp/main/main.cpp
+++ b/llama.cpp/main/main.cpp
@@ -37,9 +37,6 @@ static std::vector<llama_token> * g_output_tokens;
static bool is_interacting = false;
static bool need_insert_eot = false;
-extern "C" int nsync_futex_wake_(int *, int, char);
-extern "C" int nsync_futex_wait_(int *, int, char, const struct timespec *);
-
static bool file_exists(const std::string & path) {
std::ifstream f(path.c_str());
return f.good();
@@ -100,7 +97,7 @@ static int is_killed;
static void *safe_sigint_handler(void *arg) {
while (!is_killed)
- nsync_futex_wait_(&is_killed, 0, 0, 0);
+ usleep(50 * 1000);
console::cleanup();
printf("\n");
llama_print_timings(*g_ctx);
@@ -125,7 +122,6 @@ static void sigint_handler(int signo) {
is_interacting = true;
} else {
is_killed = true;
- nsync_futex_wake_(&is_killed, 1, 0);
for (;;) {
}
}