LaKraven / LKSL

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

TLKEventThread - Option to Cancel or Complete Events on Termination #9

Closed LaKraven closed 9 years ago

LaKraven commented 9 years ago

As the title suggests, I need to add an option to the TLKEventThread type so that the implementing developer can determine whether or not they want their descendants to Cancel or Complete any outstanding Events in the Queue/Stack upon Termination of the Thread.

Obviously, the Event Processor should default to Completing the Queue/Stack.

Note that the Queue and Stack must NOT allow any further Events to enter during Termination (otherwise we could easily have infinite loop issues on finalization)

LaKraven commented 9 years ago

Was looking at this, and realized it actually isn't possible or practical. Why? Because the Thread is being terminated... which means we want to terminate it, right? So, we don't want to have to wait 5 minutes while it conducts some pending Events we clearly wouldn't care about otherwise we wouldn't be terminating the Thread, right?

If we want to prevent the Thread from taking on new Events, then we simply call Unregister against it. All pending Events in the queue & stack will be processed, but no subsequent Events will ever hit the Thread.