Click here to Skip to main content
15,892,809 members
Home / Discussions / C#
   

C#

 
GeneralRe: thread safe log class with simple functionality Pin
BillWoodruff21-Oct-15 7:45
professionalBillWoodruff21-Oct-15 7:45 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 7:51
Member 1206160021-Oct-15 7:51 
GeneralRe: thread safe log class with simple functionality Pin
BillWoodruff21-Oct-15 7:58
professionalBillWoodruff21-Oct-15 7:58 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 8:29
Member 1206160021-Oct-15 8:29 
AnswerRe: thread safe log class with simple functionality Pin
Richard Deeming21-Oct-15 8:09
mveRichard Deeming21-Oct-15 8:09 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 8:16
Member 1206160021-Oct-15 8:16 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming21-Oct-15 9:06
mveRichard Deeming21-Oct-15 9:06 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160021-Oct-15 9:33
Member 1206160021-Oct-15 9:33 
With different AppDomains, or different processes, things get more complicated. Your code can be executing on threads from different AppDomains or processes at the same time, because they have their own copies of the buffer and the guard object. The problem you will encounter is that the FileStream constructor (or the AppendAllLines method) will throw an exception if another process is writing to the file when you try to open it.

This is fine. Let it throw. However when one process is done with it, I hope other process can now write.

Thanks for your explanation you are helping me unlike some comments I get like "don't create log classes" - please see discussion below the answer here: http://codereview.stackexchange.com/questions/108280/implementing-a-thread-safe-log-class-with-simple-functionality/108286?noredirect=1[^]

So what is your opinion do you think it is worth to use my class in my application?
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 2:01
mveRichard Deeming22-Oct-15 2:01 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 5:24
Member 1206160022-Oct-15 5:24 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 5:35
mveRichard Deeming22-Oct-15 5:35 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 6:31
Member 1206160022-Oct-15 6:31 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 6:52
mveRichard Deeming22-Oct-15 6:52 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 7:07
Member 1206160022-Oct-15 7:07 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 7:18
mveRichard Deeming22-Oct-15 7:18 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 10:36
Member 1206160022-Oct-15 10:36 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 6:35
Member 1206160022-Oct-15 6:35 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 6:54
mveRichard Deeming22-Oct-15 6:54 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 2:39
mveRichard Deeming22-Oct-15 2:39 
GeneralRe: thread safe log class with simple functionality Pin
Member 1206160022-Oct-15 5:34
Member 1206160022-Oct-15 5:34 
GeneralRe: thread safe log class with simple functionality Pin
Richard Deeming22-Oct-15 5:37
mveRichard Deeming22-Oct-15 5:37 
AnswerRe: thread safe log class with simple functionality Pin
John Torjo21-Oct-15 23:08
professionalJohn Torjo21-Oct-15 23:08 
QuestionTabelLayoutPanel Resizing at Runtime c#.net Pin
Darshan BS20-Oct-15 21:47
Darshan BS20-Oct-15 21:47 
AnswerRe: TabelLayoutPanel Resizing at Runtime c#.net Pin
OriginalGriff20-Oct-15 22:31
mveOriginalGriff20-Oct-15 22:31 
GeneralRe: TabelLayoutPanel Resizing at Runtime c#.net Pin
Darshan BS20-Oct-15 22:41
Darshan BS20-Oct-15 22:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.