Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #14422

Re: Non-blocking asynchronous execution

Newsgroups comp.lang.forth
From Albert van der Horst <albert@spenarnc.xs4all.nl>
Subject Re: Non-blocking asynchronous execution
Date 2012-07-26 15:03 +0000
Message-ID <m7rwhx.3ll@spenarnc.xs4all.nl> (permalink)
Organization Dutch Forth Workshop
References <jup4k8$u1a$1@dont-email.me>> <98951510968435@frunobulax.edu>

Show all headers | View raw


In article <98951510968435@frunobulax.edu>, Marcel Hendrix <mhx@iae.nl> wrote:
>Arnold Doray <invalid@invalid.com> writes Re: Non-blocking asynchronous execution
>
>[..]
>
>> One thing that interested me in the talk is node.js' non-blocking,
>> asynchronous execution model without using threads. I believe Erlang uses
>> something like this. How would you accomplish it using your Forth? Eg,
>
>> : set-timeout ( xtCallback timeMillisec  --  )  ... ;
>
>> : greeting ." Hello World " . ;
>> : greeting2 ." Goodbye World " . ;
>
>> ' greeting 5000 set-timeout
>> greeting2
>
>> Goodbye World ok <-- occurs immediately
>> Hello World ok  <-- occurs after 5 seconds have elapsed.
>
>> Ie, SET-TIMEOUT schedules its callback for execution at the predefined
>> time interval without blocking.
>
>I think something like this iForth/tForth construct will do.
>
>-marcel
>
>FORTH-PROCESS ape
>FORTH> : boe  5000 ~MS CR ." Hello World." CR STOP ;   ok
>FORTH> : baa  CR ." Goodbye World." ;   ok
>FORTH> ' boe RUN ape  baa
>Goodbye World. ok
>FORTH> ( 5 seconds ... )
>Hello World.

ciforth:
1000 THREAD-PET ape
: boe 5000 MS CR ." The end of the world" CR ;

'boe ape
OK
( 5 seconds ... )
The world ends.

In this and probably Marcels example, during 5 seconds an
extra process shows up on the system. The point is apparently
to accomplish this without the extra process. Hmmm.

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Non-blocking asynchronous execution mhx@iae.nl (Marcel Hendrix) - 2012-07-25 20:08 +0200
  Re: Non-blocking asynchronous execution Albert van der Horst <albert@spenarnc.xs4all.nl> - 2012-07-26 15:03 +0000
    Re: Non-blocking asynchronous execution mhx@iae.nl (Marcel Hendrix) - 2012-07-26 16:39 +0200
      Re: Non-blocking asynchronous execution Arnold Doray <invalid@invalid.com> - 2012-07-27 04:55 +0000

csiph-web