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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -