thrift TServerSocket :: acceptImpl()THRIFT_POLL()系统调用中断

时间:2017-03-24 01:38:06

标签: thrift

我用c ++编写了一个thrift服务器。当服务器运行时,我收到一个错误:

Thrift:Fri Mar 24 11:21:31 2017 TServerSocket :: acceptImpl()THRIFT_POLL()系统调用中断 Thrift:Fri Mar 24 11:21:31 2017 TServerTransport去世:未知:系统调用中断

但这个错误不会永远发生。从错误提示,THRIFT_POLL()函数中的thrift得到一个EINTER信号?我怎么能解决这个问题?

这是代码main()

int main(int argc, char **argv) {
// thread pool
shared_ptr<ServHandler> handler(new ServHandler());
shared_ptr<TProcessor> processor(new ServProcessor(handler));
shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
shared_ptr<TServerTransport> serverTransport(new TServerSocket(9090));

shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(5);
shared_ptr<PosixThreadFactory> threadFactory = shared_ptr<PosixThreadFactory>(new PosixThreadFactory());

threadManager->threadFactory(threadFactory);
threadManager->start();
printf("start...\n");

TThreadPoolServer server(processor,
        serverTransport,
        transportFactory,
        protocolFactory,
        threadManager);

server.serve();

printf("end\n");
return 0;

}

1 个答案:

答案 0 :(得分:-1)

thiis是TServerSocket :: acceptImpl()的代码部分 enter image description here