-
Notifications
You must be signed in to change notification settings - Fork 0
SimpleEvent
Event loop processes these. They are pretty much continuations.
The required first parameter is a lambda function which defines how the event is supposed to behave when it gets executed. The second parameter is not required but keep in mind that if you do not give it, the lambda function is still expected to have one parameter and this will be the event loop itself. The latter behaviour is meant for asynchronous changes for the event loop behaviour itself, like eg telling it to quit when all events have been processed.
No parameters. This will be run by the lambda statement when this Event hits the front of the queue.
No params. This is a subclassing concern. If you wish to use something different that lambdas for Event objects, you may do so but remember to clean up all references to stored data in __recycle if using EventFactory because otherwise Python memory management might not work optimally
This produces Event objects. It's also capable of holding a given amount of Event objects in memory so they can be recycled. The storage is configured to store ten Event objects by default.
Only parameter is the event. It tells the event to clean itself up so storing it will not cause any additional objects to be unnecessarily tored.
If there are reusable Event objects in the factory's storage, factory uses them first. If it runs out, it simply creates a new Event object and returns that instead.
Takes a single positive integer as argument. If more objects are in stored than the new maximum count allows, they are removed. Zero size is allowed, it just means no recycling ever happens