]> git.jsancho.org Git - gacela.git/blob - remoto.lisp
(no commit message)
[gacela.git] / remoto.lisp
1 (clines "#include <pthread.h>")
2 (clines "#include <time.h>")
3
4 (clines "#define inheap(pp) ((char *)(pp) < heap_end)")
5 (clines "static object pepe;")
6
7 (defcfun "static object staticp (object array)" 0
8   "if (inheap (array->st.st_self)) return Ct;"
9   "else return Cnil;")
10
11 (defcfun "static void *eval_code (void *parameter)" 0
12   "int t = time (NULL);"
13   "while (time (NULL) - t < 10);"
14   (eval pepe))
15
16 (defcfun "int run_thread (object code)" 0
17   "pthread_t tid;"
18   "int ret;"
19   "pepe = code;"
20   "ret = pthread_create (&tid, NULL, eval_code, NULL);"
21   "return ret;")
22
23 ;(defentry eval-code (object) (void "eval_code"))
24 (defentry run-thread (object) (int "run_thread"))
25 (defentry staticp (object) (object "staticp"))
26
27 (defun runt (code)
28   (and (staticp code) (run-thread code)))