MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / read

Method read

subprojects/llama.cpp/tools/server/server-models.cpp:938–956  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936 cv.notify_all();
937 }
938 bool read(T & output, const std::function<bool()> & should_stop) {
939 std::unique_lock<std::mutex> lk(mutex);
940 constexpr auto poll_interval = std::chrono::milliseconds(500);
941 while (true) {
942 if (!queue.empty()) {
943 output = std::move(queue.front());
944 queue.pop();
945 return true;
946 }
947 if (writer_closed.load()) {
948 return false; // clean EOF
949 }
950 if (should_stop()) {
951 close_read(); // signal broken pipe to writer
952 return false; // cancelled / reader no longer alive
953 }
954 cv.wait_for(lk, poll_interval);
955 }
956 }
957 bool write(T && data) {
958 std::lock_guard<std::mutex> lk(mutex);
959 if (reader_closed.load()) {

Callers 15

read_tensor_dataMethod · 0.45
load_tensorsMethod · 0.45
load_legacy_imatrixFunction · 0.45
mainFunction · 0.45
deserialize_stringFunction · 0.45
deserializeMethod · 0.45
multiple_choice_scoreFunction · 0.45
kl_divergenceFunction · 0.45
server_http_proxyMethod · 0.45
llamaFunction · 0.45
handleStreamResponseMethod · 0.45

Calls 4

should_stopFunction · 0.85
emptyMethod · 0.65
loadMethod · 0.65
popMethod · 0.45

Tested by 1

read_fileFunction · 0.36