Timeline for Generic object pool class using Spinlock/Monitor
Current License: CC BY-SA 3.0
4 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 8, 2015 at 0:37 | history | edited | ChrisWue | CC BY-SA 3.0 |
fixed typo
|
| Mar 7, 2015 at 10:39 | vote | accept | Tcqqp | ||
| Mar 4, 2015 at 21:02 | comment | added | Tcqqp |
Concerning state-safety, I've wrapped the working part of Fetch in a finally block so that an unexpected ThreadAbortException won't cause trouble for other threads. I agree that the locking logic is not easily perceptible, especially not in the Expand method. It didn't have to be difficult if I chose to use a spinlock all the way, but that may be very inefficient during the creation of new units. Performance is not really worth it to be fair. In any typical case, the operations performed by the fetched object should massively overrule the time taken to get the object.
|
|
| Mar 4, 2015 at 20:36 | history | answered | ChrisWue | CC BY-SA 3.0 |