MCPcopy Create free account
hub / github.com/apache/brpc / Predict

Method Predict

example/http_c++/http_server.cpp:184–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 };
183
184 static void* Predict(void* raw_args) {
185 std::unique_ptr<PredictJobArgs> args(static_cast<PredictJobArgs*>(raw_args));
186 if (args->pa == NULL) {
187 LOG(ERROR) << "ProgressiveAttachment is NULL";
188 return NULL;
189 }
190 for (int i = 0; i < 100; ++i) {
191 char buf[48];
192 int len = snprintf(buf, sizeof(buf), "event: foo\ndata: Hello, world! (%d)\n\n", i);
193 args->pa->Write(buf, len);
194
195 // sleep a while to send another part.
196 bthread_usleep(10000 * 10);
197 }
198 return NULL;
199 }
200
201 void stream(google::protobuf::RpcController* cntl_base,
202 const HttpRequest*,

Callers

nothing calls this directly

Calls 3

snprintfFunction · 0.85
bthread_usleepFunction · 0.85
WriteMethod · 0.45

Tested by

no test coverage detected