要实现超时在C一个函数 [英] Want to Implement Timeout for one function in C

查看:129
本文介绍了要实现超时在C一个函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这里,我有一个函数,它是监听模式。此功能列出一些东西,我得到了一些形成设备。

Here i have one function which is listen mode. this function listing something which i got form some device.

下面时,我的功能是听那个时候我想创建超时模式。如果我不会得到来自特定设备的任何回应,比我想从这个函数O退出,必须通知。

Here when my function is in listen mode that time i want to create timeout. if i will not get any response from particular device than i want o exit from this function and have to notify.

如果超时期间,如果我会从设备响应比我继续工作,并停止该超时并没有限制完成任何持续时间这项工作。

if during this timeout period if i will get response from device than i have to continue with work and stop this timeout and there is no limits to complete this work in any time duration.

那么,怎样才能实现我这个东西的功能。

So how can i implement this thing for a function.

任何机构可以请我帮我实现这个东西带超时功能。

Any body please can me help me to implement this thing with timeout functionality.

推荐答案

看看 2人报警。您可以设置或关闭,这将在一定时间之后经过一段发送到您的应用程序的信号。

Take a look at man 2 alarm. You can set or disable signals which will be sent to your application after a certain time period elapses.

这篇关于要实现超时在C一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆