LaKraven / LKSL

LaKraven Studios Standard Library
http://otapi.com
Other
51 stars 15 forks source link

Generics Redux - Make the Event Engine use ILKObjectHolder for Events #114

Closed LaKraven closed 9 years ago

LaKraven commented 9 years ago

Currently, the Event Engine uses a hand-rolled Reference Counting solution to manage the Lifetime of TLKEvent instances.

That works pretty well, but requires additional code that is no longer required.

By using ILKEventHolder (defined as ILKObjectHolder<TLKEvent>) as the item type for the Event Lists (queues/stacks), we get the defacto Reference Counting advantages of Interfaces to manage the Lifetime of each Event.

Furthermore, should the implementing developer wish to retain an internal reference to an existing Event (not something that's recommended, but may be useful for corner-cases) they will be able to do so simply by creating their own ILKEventHolder instance and dispatching the Event to the Queue, Stack, or Scheduler using the Holder instead of the Event itself.

LaKraven commented 9 years ago

Completed in 88b2b5b