admin管理员组文章数量:1307121
manpage for close
is clear on its multithread use for a given file descriptor. However it's not stated really clear in case of duplicated file descriptors.
If i have a file descriptor duplicated (both point to the same resource), is that thread safe to perform close of each respective fd in different threads? There is a refcount used to release a resource at the last close, but is that access thread safe?
manpage for close
is clear on its multithread use for a given file descriptor. However it's not stated really clear in case of duplicated file descriptors.
If i have a file descriptor duplicated (both point to the same resource), is that thread safe to perform close of each respective fd in different threads? There is a refcount used to release a resource at the last close, but is that access thread safe?
Share Improve this question asked Feb 3 at 10:03 Viktor KhristenkoViktor Khristenko 9331 gold badge6 silver badges20 bronze badges 1 |1 Answer
Reset to default 2if i have a file descriptor duplicated (both point to the same resource), is that thread safe to perform close of each respective fd in different threads?
yes
There is a refcount used to release a resource at the last close, but is that access thread safe?
yes
本文标签: cThreadsafety of closing duplicated file descriptorsStack Overflow
版权声明:本文标题:c - Thread-safety of closing duplicated file descriptors - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741829559a2399851.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
write
) using the same file descriptor in the same process at the time the file descriptor is being closed by the process, but other than that, you do not need to worry about it. – Ian Abbott Commented Feb 3 at 10:43