blob: da4701d929f7752fa1f4d826f61efb046a771a68 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#lang rhombus/static
import:
lib("web-server/http.rkt") open
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!")
fun loop():
println("Hello World!")
sleep(1)
loop()
fun sim_world():
let wrld = world.World()
wrld.simulate()
println("Creating thread")
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)
|