File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -94,7 +94,9 @@ static int ping_pong_client() {
9494
9595 auto run_ping_pong_worker = [&]() -> int {
9696 // Round-robin dispatch threads in WorkPool
97- work_pool->thread_migrate ();
97+ if (work_pool) {
98+ work_pool->thread_migrate ();
99+ }
98100 // After the above call, this function begins to run in another vCPU
99101
100102 auto buf = malloc (FLAGS_buf_size);
@@ -238,7 +240,7 @@ static int echo_server() {
238240 // Define handler for new connections.
239241 // Every connection will be running in a new thread after it is accepted.
240242 auto handler = [&](photon::net::ISocketStream* sock) -> int {
241- if (FLAGS_vcpu_num > 1 ) {
243+ if (work_pool ) {
242244 // Migrate current thread (connection) to another vCPU in WorkPool.
243245 // The default policy is round-robin.
244246 work_pool->thread_migrate ();
You can’t perform that action at this time.
0 commit comments