mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Getting somewhere, with the new schedulers, the TASK logic works now much better!
- Schedulers are stopped when the parent object is destroyed. - Parent objects are garbage cleaned. - Destructors are called. Jippie! Results!!!
This commit is contained in:
parent
e98814e8d4
commit
02d4bbf3ff
@ -132,7 +132,7 @@ function BASE:_SetDestructor()
|
||||
-- TODO: Okay, this is really technical...
|
||||
-- When you set a proxy to a table to catch __gc, weak tables don't behave like weak...
|
||||
-- Therefore, I am parking this logic until I've properly discussed all this with the community.
|
||||
--[[
|
||||
--
|
||||
local proxy = newproxy(true)
|
||||
local proxyMeta = getmetatable(proxy)
|
||||
|
||||
@ -147,7 +147,7 @@ function BASE:_SetDestructor()
|
||||
-- table is about to be garbage-collected - then the __gc hook
|
||||
-- will be invoked and the destructor called
|
||||
rawset( self, '__proxy', proxy )
|
||||
--]]
|
||||
--
|
||||
end
|
||||
|
||||
--- This is the worker method to inherit from a parent class.
|
||||
|
||||
@ -69,7 +69,7 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
||||
self:T3( self.Schedule[Scheduler][self.CallID] )
|
||||
|
||||
self.Schedule[Scheduler][self.CallID].CallHandler = function( CallID )
|
||||
self:F3( CallID )
|
||||
self:F( CallID )
|
||||
|
||||
local ErrorHandler = function( errmsg )
|
||||
env.info( "Error in timer function: " .. errmsg )
|
||||
@ -84,15 +84,16 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
||||
Scheduler = self.PersistentSchedulers[CallID]
|
||||
end
|
||||
|
||||
self:T3( { Scheduler = Scheduler } )
|
||||
self:T( { Scheduler = Scheduler } )
|
||||
|
||||
if Scheduler then
|
||||
|
||||
local Schedule = self.Schedule[Scheduler][CallID]
|
||||
|
||||
self:T3( { Schedule = Schedule } )
|
||||
self:T( { Schedule = Schedule } )
|
||||
|
||||
local ScheduleObject = Scheduler.TimeEventObject
|
||||
--local ScheduleObjectName = Scheduler.TimeEventObject:GetNameAndClassID()
|
||||
local ScheduleFunction = Schedule.Function
|
||||
local ScheduleArguments = Schedule.Arguments
|
||||
local Start = Schedule.Start
|
||||
@ -127,7 +128,7 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
||||
( Randomize * Repeat / 2 )
|
||||
) +
|
||||
0.01
|
||||
self:T( { ScheduleArguments, "Repeat:", CurrentTime, ScheduleTime } )
|
||||
self:T3( { ScheduleArguments, "Repeat:", CurrentTime, ScheduleTime } )
|
||||
return ScheduleTime -- returns the next time the function needs to be called.
|
||||
else
|
||||
timer.removeFunction( ScheduleID )
|
||||
@ -138,7 +139,7 @@ function TIMER:AddSchedule( Scheduler, ScheduleFunction, ScheduleArguments, Star
|
||||
ScheduleID = nil
|
||||
end
|
||||
else
|
||||
self:E( "Scheduled obscolete call ..." )
|
||||
--self:E( "Scheduled obscolete call for CallID: " .. CallID )
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
@ -64,9 +64,11 @@ Include.File( "Tasking/Task_A2G" )
|
||||
--- Declare the event dispatcher based on the EVENT class
|
||||
_EVENTDISPATCHER = EVENT:New() -- Core.Event#EVENT
|
||||
|
||||
--- Declare the main database object, which is used internally by the MOOSE classes.
|
||||
_DATABASE = DATABASE:New() -- Database#DATABASE
|
||||
|
||||
--- Declare the timer dispatcher based on the TIMER class
|
||||
_TIMERDISPATCHER = TIMER:New() -- Core.Timer#TIMER
|
||||
|
||||
--- Declare the main database object, which is used internally by the MOOSE classes.
|
||||
_DATABASE = DATABASE:New() -- Database#DATABASE
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20161209_1413' )
|
||||
env.info( 'Moose Generation Timestamp: 20161213_1239' )
|
||||
|
||||
local base = _G
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
env.info( '*** MOOSE DYNAMIC INCLUDE START *** ' )
|
||||
env.info( 'Moose Generation Timestamp: 20161209_1413' )
|
||||
env.info( 'Moose Generation Timestamp: 20161213_1239' )
|
||||
|
||||
local base = _G
|
||||
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user