Process and Process Scheduler Tweaks

This commit is contained in:
Krausus
2015-07-18 13:14:32 -04:00
parent fd87909ff5
commit c520ebd8a5
22 changed files with 257 additions and 204 deletions
+17 -10
View File
@@ -1,21 +1,28 @@
var/global/list/object_profiling = list()
/datum/controller/process/obj
var/tmp/datum/updateQueue/updateQueueInstance
/datum/controller/process/obj/setup()
name = "obj"
schedule_interval = 20 // every 2 seconds
updateQueueInstance = new
start_delay = 8
/datum/controller/process/obj/started()
..()
if(!updateQueueInstance)
if(!processing_objects)
processing_objects = list()
else if(processing_objects.len)
updateQueueInstance = new
if(!processing_objects)
processing_objects = list()
/datum/controller/process/obj/statProcess()
..()
stat(null, "[processing_objects.len] objects")
/datum/controller/process/obj/doWork()
if(updateQueueInstance)
updateQueueInstance.init(processing_objects, "process")
updateQueueInstance.Run()
for(var/obj/O in processing_objects)
if(istype(O) && isnull(O.gcDestroyed))
try
O.process()
catch(var/exception/e)
catchException(e, O)
// Use src explicitly after a try/catch, or BYOND messes src up. I have no idea why.
src.scheck()
else
processing_objects -= O