1. Threads in Eu 2.5?

I think threads are needed in Euphoria. The example below would be 
fairly easy to use. Many programs would benifit from this.
procedure new_thread(integer routine_id,sequence params,int priority)
new_thread() starts the thread and returns imediatly.

routine_id is the routine id for the procedure to run

params is "params must be a sequence of argument values of length n, 
where n is the number of arguments required by the procedure. If the 
procedure does not take any arguments then params should be {}."(copied 
from manual: call_proc)

priority is somthing like HIGH, LOW, NORMAL, ABOVENORMAL, ect


procedure a()
integer t
t=time()
for z=1 to 1000000+i do
--do something that takes a lot of time here
end for
?time()-t  --a fairly high number
end procedure

procedure b(integer i)
integer t
t=time()
for z=1 to 1000000+i do
--do something that takes a lot of time here
end for
?time()-t  --a fairly high number
end procedure

integer tt
tt=time()
new_thread(routine_id("a"),{},ABOVENORMAL)
new_thread(routine_id("b"),{rand(10)},LOW)
?time()-tt  --would display a number near 0 because new_thread() returns 
imediatly

new topic     » topic index » view message » categorize

2. Re: Threads in Eu 2.5?

CoJaBo wrote:

> I think threads are needed in Euphoria. The example below would be
> fairly easy to use. Many programs would benifit from this.

<snip>

Sorry for repeating myself:
This has been discussed here several times before. I think most people
on this list agree with you. smile

Regards,
   Juergen

-- 
 /"\  ASCII ribbon campain  |  Math problems?
 \ /  against HTML in       |  Call 1-800-[(10x)(13i)^2]-[sin(xy)/2.362x].
  X   e-mail and news,      |
 / \  and unneeded MIME     |  http://home.arcor.de/luethje/prog/

new topic     » goto parent     » topic index » view message » categorize

3. Re: Threads in Eu 2.5?

On 25 Jan 2004, at 15:14, CoJaBo wrote:

> 
> 
> I think threads are needed in Euphoria. The example below would be 
> fairly easy to use. Many programs would benifit from this.
> procedure new_thread(integer routine_id,sequence params,int priority)
> new_thread() starts the thread and returns imediatly.
> 
> routine_id is the routine id for the procedure to run
> 
> params is "params must be a sequence of argument values of length n, 
> where n is the number of arguments required by the procedure. If the 
> procedure does not take any arguments then params should be {}."(copied 
> from manual: call_proc)
> 
> priority is somthing like HIGH, LOW, NORMAL, ABOVENORMAL, ect
> 
> 
> procedure a()
> integer t
> t=time()
> for z=1 to 1000000+i do
> --do something that takes a lot of time here
> end for
> ?time()-t  --a fairly high number
> end procedure
> 
> procedure b(integer i)
> integer t
> t=time()
> for z=1 to 1000000+i do
> --do something that takes a lot of time here
> end for
> ?time()-t  --a fairly high number
> end procedure
> 
> integer tt
> tt=time()
> new_thread(routine_id("a"),{},ABOVENORMAL)
> new_thread(routine_id("b"),{rand(10)},LOW)
> ?time()-tt  --would display a number near 0 because new_thread() returns 
> imediatly

I think you can do this with the Al Getz Windows Server Without Equal in the 
user archives, just let your new thread know it is to send it's results to the 
server, let the server be your app's giu, and Al naturally knows more about 
this than i do. I wasn't joking or poking fun when i said he reinvented win3.x. 
Your threads would be independant processes, but you can still send them 
msgs in many ways on windows, there's several programs in the archives 
you can use instead of the real threads msgs. Can't change or set priorities 
tho.

Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu