Pthreads - How to check file mode

Hi ,
I have a multithreaded prog , spwanning treads which make use of a OUT stream.
With multiple threads , trying to access the OUT stream , I got a crash , while trying to fclose the OUT stream .

Is there a way I can check if the OUT stream is being used ?

Tried fcntl to set a waiting lock , but that does not seem to work for threads within the process.

Thanks in advance !
Best regards ,
CB
Is there a way I can check if the OUT stream is being used?
No.

Tried fcntl to set a waiting lock , but that does not seem to work for threads within the process.
File locking isn't the solution.

If you're having sync issues, why not synchronise access to the resource? You can use a mutex.
Thanks for your reply :)
Sync with mutex might not be possible as the stream is called at a lot of places .
While browsing I came across a thread safe lock function flockfile() this creates a blocking lock on the FILE stream . Will try this out now ...

Thanks
Topic archived. No new replies allowed.