C# Sharing file handles across threads -
i have piece of code executed n
threads. code contains,
for(;;)//repeat 10,000 times { lock(padlock) { file.appendalltext(filename, text); } }
basically, threads write same set of 10,000 files , hence files shared resource. issue 10,000 open,write,close performed each thread slowing down program considerably. if share file handlers across threads, i'd able keep them open , write different threads. can throw light on how can proceed?
let threads write syncronised list. let 1 thread 'eat' items on list , write them single filewriter file.
presto problem solved in exchange memory usage.
Comments
Post a Comment