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


Groups > comp.lang.forth > #14380

Re: Non-blocking asynchronous execution

From mhx@iae.nl (Marcel Hendrix)
Subject Re: Non-blocking asynchronous execution
Newsgroups comp.lang.forth
Message-ID <98951510968435@frunobulax.edu> (permalink)
Date 2012-07-25 20:08 +0200
References jup4k8$u1a$1@dont-email.me>
Organization Wanadoo

Show all headers | View raw


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.

Back to comp.lang.forth | Previous | NextNext 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