summaryrefslogtreecommitdiff
path: root/examples/server/server.cpp
diff options
context:
space:
mode:
authorStephen Nichols <snichols@users.noreply.github.com>2023-08-04 06:37:24 -0500
committerGitHub <noreply@github.com>2023-08-04 13:37:24 +0200
commit5f631c26794b6371fcf2660e8d0c53494a5575f7 (patch)
treeebf542b1889557a13620c1ffe9f5bbc99836ad90 /examples/server/server.cpp
parent415e99fec27be5a2e4283f1937afd17eb33fbd66 (diff)
Fixing race condition in server and partial stream handling in frontend. (#2391)
* Fixing race condition in server.cpp and partial stream handling in completion.js * Reverting assert edits. * Adding newline to eof
Diffstat (limited to 'examples/server/server.cpp')
-rw-r--r--examples/server/server.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/server/server.cpp b/examples/server/server.cpp
index c0725088..6f7a66da 100644
--- a/examples/server/server.cpp
+++ b/examples/server/server.cpp
@@ -1274,7 +1274,11 @@ int main(int argc, char **argv)
sink.done();
return true;
};
- res.set_chunked_content_provider("text/event-stream", chunked_content_provider);
+ const auto on_complete = [&](bool) {
+ llama.mutex.unlock();
+ };
+ lock.release();
+ res.set_chunked_content_provider("text/event-stream", chunked_content_provider, on_complete);
} });
svr.Get("/model.json", [&llama](const Request &, Response &res)