我目前正在实现一些在后台模式下从 TCP 套接字读取的逻辑。
CFReadStreamRead
函数用于从套接字获取一些数据,现在一切正常。
但我想知道 iPhone OS 4.x 如何在后台模式下处理阻塞 I/O 操作。例如:CFReadStreamRead
函数在等待一些传入数据时可能会阻塞数小时。
Are there any official constraints like 10 minutes for the background tasks? Will my application be killed by iPhone OS for the case of long-running blocking I/O operation?
Please note - I'm not running the blocking I/O function in the background task. Code itself is situated inapplicationDidEnterBackground
method of myUIApplicationDelegate
.
Application itself is configured with "voip" parameter in Info.plst file + CFReadStream is configured according to the recommendations of Apple withkCFStreamNetworkServiceTypeVoIP
parameter.
So basically this is a regular scenario of VoIP application in the background mode.
Thanks!