mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-27 20:04:35 +00:00
server : fix crash in Debug on macOS (I have no idea why this fixes it!?)
This commit is contained in:
parent
197a0a9e23
commit
ef18f4d579
@ -2440,7 +2440,21 @@ int main(int argc, char **argv)
|
|||||||
{"hostname", sparams.hostname},
|
{"hostname", sparams.hostname},
|
||||||
{"port", sparams.port},
|
{"port", sparams.port},
|
||||||
});
|
});
|
||||||
std::thread t([&llama]()
|
|
||||||
|
// run the HTTP server in a thread - see comment below
|
||||||
|
std::thread t([&]()
|
||||||
|
{
|
||||||
|
if (!svr.listen_after_bind())
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// GG: if I put the main loop inside a thread, it crashes on the first request when build in Debug!?
|
||||||
|
// "Bus error: 10" - this is on macOS, it does not crash on Linux
|
||||||
|
//std::thread t2([&]()
|
||||||
{
|
{
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while (running)
|
while (running)
|
||||||
@ -2448,12 +2462,9 @@ int main(int argc, char **argv)
|
|||||||
running = llama.update_slots();
|
running = llama.update_slots();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
//);
|
||||||
|
|
||||||
if (!svr.listen_after_bind())
|
t.join();
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
llama_backend_free();
|
llama_backend_free();
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user