我在poll()
系统调用中遇到分段错误,并为以下代码转储了核心
wait_time(int wait_time)
{
struct pollfd fds;
poll(&fds, 0, wait_time);
}
从其他功能
void xyz()
{
int a=0;
if (a==2) {
wait_time(3);
a=0;
}
a++;
//something else i am doing
}
main()
{
while(1)
{
xyz();
}
}
如何解决poll()系统调用上的核心转储?
最佳答案
下面的解决方案工作正常,
wait_time(int wait_time)
{
poll(NULL, 0, wait_time);
}