Two threads reading from same file?
- From: noleander <noleander@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 11 Apr 2005 21:29:01 -0700
I've got a Visual C++ application. It has two threads. Each thread needs
to read from the same data file (no writing is necessary).
No matter what I try, it appears that the two threads interfere with each
other's seek pointer. The reads succeed, but they are reading from the wrong
place in the file. Clearly, the seek pointers are getting altered by the
other thread.
I must be opening the files wrong. I've tried (in each thread):
_open()
fopen()
_open() followed by call to fdopen()
_sopen() followed by fdoen()
Question: What is the proper way to open a single file from two (or more)
threads so that each thread can read from the file simultaneously?
.
- Follow-Ups:
- Re: Two threads reading from same file?
- From: Slava M. Usov
- Re: Two threads reading from same file?
- From: Tim Roberts
- Re: Two threads reading from same file?
- Prev by Date: Re: How to get the value of the FPU registers?
- Next by Date: Re: HANDLE Thread Safety
- Previous by thread: Precision pointer Issue
- Next by thread: Re: Two threads reading from same file?
- Index(es):
Relevant Pages
|