sogou / srpc

RPC framework based on C++ Workflow. Supports SRPC, Baidu bRPC, Tencent tRPC, thrift protocols.
Apache License 2.0
1.96k stars 386 forks source link

client.Echo start multi thread,how can I start only one thread? #377

Closed ouclbc closed 7 months ago

Barenboim commented 7 months ago

这个是workflow的全局配置,在workflow的global settings里,把 poller_threads和handler_threads都改成1

int main()
{
    struct WFGlobalSettings settings = GLOBAL_SETTINGS_DEFAULT;
    settings.poller_threads = 1;
    settings.handler_threads = 1;
    WORKFLOW_library_init(&settings);
    ...
}
ouclbc commented 7 months ago

谢谢,但是我按照上面的在代码里面修改,还是有三个线程,还有其他地方需要修改么?

holmes1412 commented 7 months ago

@ouclbc hi,你是说进程整体有3个线程么?是不是有一个是你的主线程?

ouclbc commented 7 months ago

不是主线程,我开了一个线程,然后调用获取接口时查看有三个。 19596 u0_a114 RT -10 5.3G 133M 100M S 1.6 2.3 0:00.02 getPoseThread org.freedesktop.monado.openxr_runtime.out_of_process 19598 u0_a114 RT -10 5.3G 133M 100M S 1.0 2.3 0:00.01 getPoseThread org.freedesktop.monado.openxr_runtime.out_of_process 19597 u0_a114 RT -10 5.3G 133M 100M S 0.6 2.3 0:00.00 getPoseThread org.freedesktop.monado.openxr_runtime.out_of_process

Barenboim commented 7 months ago

你开了一个,然后poller和handler各一个?所以是三?

ouclbc commented 7 months ago

了解了