diff options
Diffstat (limited to 'main.rhm')
-rw-r--r-- | main.rhm | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -5,26 +5,29 @@ import: lib("web-server/servlet.rkt") open lib("web-server/servlet-env.rkt") open "thread/thread.rhm" open + "src/world.rhm" fun start(req): + println(#{request-method}(req)) + println(#{request-post-data/raw}(req)) #{response/xexpr}("Hello world!") -//#{serve/servlet}(start, #{#:launch-browser?}: #false, #{#:servlet-path}: "/game") fun loop(): println("Hello World!") sleep(1) loop() -fun hello(): - let thread_evt = thread_receive_evt() - let sync_res = sync_timeout(1/500, thread_evt) - if !sync_res - | println("No sync result") - | println("Got message " +& thread_receive()) +fun sim_world(): + let wrld = world.World() + wrld.simulate() + println("Creating thread") -def thr: thread(hello) -thread_send(thr, "Hello") +def thr: thread(sim_world) + +// Create webserver +#{serve/servlet}(start, #{#:launch-browser?}: #false, #{#:servlet-path}: "/game") + +// Wait on world simulation thread so we don't kill the world before it has cleanly exited thread_wait(thr) -println("Thread done") |