Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Linux で posix ベースのスレッドを使用して、ノンブロッキング ソケットをリッスンしています。このスレッドを特定の時間、たとえば.01秒の間呼び出したいと思います。それを行う方法はありますか?ありがとう
select() または pselect() 関数を 0.01 秒のタイムアウトで使用できます。そうすれば、スレッドはソケットを待つことができます (ブロックか非ブロックかは関係ありません)。select() が戻ると、ソケットの準備が整ったかどうか、または割り当てられたタイムアウト内に何も起こらなかったかどうかが通知されます。