Re: tasks

new topic     » goto parent     » topic index » view thread      » older message » newer message
ne1uno said...
useless_ said...

I haven't coded anything new and complicated in Euphoria for a couple years, and i just downloaded version 4.0.4, and see task.e is now built in, and my older 4.0.b2 code won't run because the new doesn't have my mods in it, and it doesn't look like i can add my code.

Or can i? And how?

Whatever happened to task message handling? I thought someone had a great and glorious system that beat mine.

useless

I have an very early version you and ry worked on that just had taskset and taskget. I don't recall any competing system. I don't think anything was ever committed.

the code could be added to task.e to work out any details prior to getting builtin. please post your version. I doubt anything could be added to version 4.0, though it would likely not be a breaking change anyway.

I have probably modified this, don't have any of the original files.

sequence taskvars_ids = {} 
sequence taskvars_datas = {} 
public include task.e 
--** 
--==== task get/set var 
-- from 09/2009 useless/kat rwilly/ryanj irc/euforum. 
-- why were these not added to task.e? 
-- a later version treated vars more like a stack 
-- possibly tracking multiple variables per task? 
-- and added a msg que per task. 
-- then the project imploded? 
 
-- this is an earlier simple cutup version. 
-- multiple calls to set will overwrite the task var 
-- get does not remove and there is no message que. 
-- 
 
public function task_get_var(atom taskid) 
	atom idx 
 
	idx = find(taskid, taskvars_ids) 
 
	if idx > 0 and taskid >= 0 then 
		return taskvars_datas[idx] 
	end if 
	return -999999 
end function 
 
public procedure task_set_var(atom taskid, object taskdata) 
	atom idx 
 
	idx = find(taskid, taskvars_ids) 
	if idx = 0 and taskid >= 0 then 
		taskvars_ids &= taskid 
		taskvars_datas &= {taskdata} 
	elsif idx > 0 and taskid >= 0 then 
		taskvars_datas[idx] = taskdata 
	end if 
	--maybe should error if bad taskid? 
end procedure 
 



There is considerably more code than that.

useless

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu