Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
1,471
Widok
0
27/02/2019 12:48 pm
Topic starter
code example
1 Answer
0
27/02/2019 12:49 pm
Topic starter
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
static ReaderWriterLock locker = new ReaderWriterLock(); public void addToTargetFile(string text) { locker.AcquireWriterLock(3000); try { using (StreamWriter sw = File.AppendText(target_file)) { sw.WriteLine(text); } } finally { locker.ReleaseWriterLock(); } } |
static ReaderWriterLock locker = new ReaderWriterLock(); public void addToTargetFile(string text) { locker.AcquireWriterLock(3000); try { using (StreamWriter sw = File.AppendText(target_file)) { sw.WriteLine(text); } } finally { locker.ReleaseWriterLock(); } }