Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > open/fopen read/fread in multithreaded environment.

Reply
Thread Tools

open/fopen read/fread in multithreaded environment.

 
 
Sheth Raxit
Guest
Posts: n/a
 
      11-23-2007
even thred is not part of C-std, i feel its most relavant to
comp.lang.c
hope it will not off-topic

-------
I am having data/or Text file, which is only used for reading by
multiplethreads in same process.

Reading may be done by in following possible way.
1.each Thread fopen,fread,fclose <fread may be called in loop>
2.each Thread open, read,close <fread may be called in loop>
3.Main Thread will fopen, childthread will fread in loop , mainthread
will fclose at end.
4.Main Thread will open, childthread will read in loop , mainthread
will close at end.

<in 3 and 4 above return value of open/fopen will be global value <or
may be pass to function but i think it is shared between multiple
thread.>

Assuming there will be a main thread and 60 other thread, Assuming no
thread is writing to file do i need to have any of above code having
pthread_mutex_lock/unlock ?

i.e. i want to know any code is critical section ? assuming the
variable in which they are reading are all function's local
variable,<dynamic memory are referred by differnt pointer of each
thread so no worry>

Thanks,
Raxit
"Thread, Mutex, Buggy Code, Deadline results Nightmare ...!"
 
Reply With Quote
 
 
 
 
Richard Heathfield
Guest
Posts: n/a
 
      11-23-2007
Sheth Raxit said:

> even thred is not part of C-std, i feel its most relavant to
> comp.lang.c


comp.unix.programmer would be more relevant than comp.lang.c - and
comp.programming.threads is another possibility, according to my news
server.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Child Thread Can't Write To Session In Multithreaded ASP.NET =?Utf-8?B?Q2hyaXM=?= ASP .Net 2 06-04-2004 09:14 PM
Every ASP.NET application - a multithreaded windows app? Pavils Jurjans ASP .Net 7 06-02-2004 05:07 PM
Re: Sessions variable access in multithreaded asp.net Natty Gur ASP .Net 3 08-05-2003 12:55 PM
Multithreaded Throughput Degradation in Java/Oracle Application Robert Brown Java 5 07-31-2003 05:05 AM
Re: Sessions variable access in multithreaded asp.net David Browne ASP .Net 1 07-29-2003 03:59 AM



Advertisments