Opened 14 years ago
Closed 13 years ago
#1545 closed feature request (done)
Implement a thread-safe Log
Reported by: | cneumuel | Owned by: | mkommend |
---|---|---|---|
Priority: | medium | Milestone: | HeuristicLab 3.3.5 |
Component: | Core | Version: | 3.3.5 |
Keywords: | Cc: |
Description
The current Log implementation is not thread-safe. This is especially problematic if one thread adds a message and another thread (like the UI-thread) enumerates over the log-messages.
Proposal: A ThreadSafeLog which takes another log in the constructor, but ensures thread safety.
ILog threadSafeLog = new ThreadSafeLog(new Log());
Change History (16)
comment:1 Changed 14 years ago by cneumuel
- Status changed from new to accepted
comment:2 Changed 14 years ago by cneumuel
- Owner changed from cneumuel to swagner
- Status changed from accepted to reviewing
comment:3 Changed 13 years ago by mkommend
- Owner changed from swagner to mkommend
comment:4 Changed 13 years ago by mkommend
- Owner changed from mkommend to cneumuel
- Status changed from reviewing to assigned
Review comments:
The ThreadSafeLog should implement IDisposable in addition to providing a finalizer (http://msdn.microsoft.com/en-us/library/fs2xkftw.aspx).
It is not necessary to implement IDisposeable or a finalizer since the ThreadSafeLog only uses managed resources.- IMHO the cloning ctor should also request a read lock on the original object.
comment:5 Changed 13 years ago by mkommend
- Owner changed from cneumuel to mkommend
comment:6 Changed 13 years ago by mkommend
- Status changed from assigned to accepted
comment:7 Changed 13 years ago by mkommend
- Owner changed from mkommend to swagner
- Status changed from accepted to reviewing
r6516: Removed finalizer and locked cloning.
comment:8 Changed 13 years ago by gkronber
- Owner changed from swagner to gkronber
comment:9 Changed 13 years ago by gkronber
Reviewed r6516.
comment:10 Changed 13 years ago by gkronber
- reviewed class ThreadSafeLog
- removed the LockRecursionPolicy.SupportsRecursion option which is not necessary
- added unit test for the thread safe log.
comment:11 Changed 13 years ago by gkronber
- Status changed from reviewing to readytorelease
comment:12 Changed 13 years ago by swagner
- Owner changed from gkronber to swagner
- Status changed from readytorelease to assigned
comment:13 Changed 13 years ago by swagner
- Status changed from assigned to accepted
comment:14 Changed 13 years ago by swagner
r6547: Changed ThreadSafeLogTest as testing the race condition with the unsafe log resulted in strange exceptions sometimes.
comment:15 Changed 13 years ago by swagner
- Owner changed from swagner to mkommend
- Status changed from accepted to readytorelease
comment:16 Changed 13 years ago by swagner
- Resolution set to done
- Status changed from readytorelease to closed
- Version changed from 3.3.4 to 3.3.5
Note: See
TracTickets for help on using
tickets.
r6424 added threadsafe log