-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix filetarget: Thread was being aborted (#2) #1403
Conversation
Need for Thread.ResetAbort();
Thank you 304Modified for attempting to fix this issue, but it is not quite there.
The call on lock(SyncRoot) will also cause a ThreadAbortException which is currently not caught I think using Thread.Abort() is just bad practice anyway and is not needed in this context (http://stackoverflow.com/questions/2251964/c-sharp-thread-termination-and-thread-abort). Instead, what about using a ManualResetEvent, or the lighter weight ManualResetEventSlim on .NET 4.5? Something like: private ManualResetEvent appenderManualResetEvent;
Stop would look like this:
|
Thanks for the info. I think it would be nice to fix this without thread. Is it possible to send a PR for this? |
If you must use Thread.Abort() the code should look like:
|
I logged 1415, with a fix, but like I said in the PR, I don't know why there is a dedicated thread being spun up to do this. Could it not just be a simple timer? |
Need for Thread.ResetAbort();
Fixes #1385
See http://stackoverflow.com/questions/1856286/threadabortexception
Thanks @jonreis!