线程和文件描述符 [英] Threads and file descriptors

查看:111
本文介绍了线程和文件描述符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉没有自己进行研究并在此处提出要求.我时间不多了.

Am sorry for not doing my own research and asking it here. I am slightly short of time.

是否有两个文件描述符表,用于从单个线程产生的两个或更多线程.两个或多个子线程正在同时访问同一文件,那么同一文件从不同线程(针对特定线程)的两个不同打开的偏移量是吗?

Is it possible to have two file descriptor table for two or more threads spwaned from a single thread. The two or more child threads are concurrently accessing same file, so is the offset for two different opens for same file from different threads, thread specific?

谢谢

推荐答案

文件描述符在线程之间共享.如果要特定于线程"的偏移量,为什么不让每个线程使用不同的文件描述符(多次open(2))?

The file descriptors are shared between the threads. If you want "thread specific" offsets, why not have each thread use a different file descriptor (open(2) multiple times) ?

这篇关于线程和文件描述符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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