#!/usr/local/bin/sbcl --script
;
; This example shows you how 2 concurrent programming tasks are grid executed,
; the first on the best machine (0) and the second on the second best machine (1).
;
; Returned format: (((result "ip" self_executed_flag) thread_id) ((result "ip" self_executed_flag) thread_id))
;
; NOTE: main_thread (ID of main prog) is a random number. If ommitted (from sgp-make-thread and
; sgp-join-threads) it defaults to 0.
;

(load "sgp_thread.lisp")

(let ((threads NIL) (main_thread (+ 10000000 (random 90000000 (make-random-state t)))))
  (setq threads (list
    (sgp-make-thread '(progn (load "porta.lisp") (porta '(* 3 4) 0 T)) main_thread)
    (sgp-make-thread '(progn (load "porta.lisp") (porta '(* 2 7) 1 T)) main_thread)
  ))
  (prin1 (sgp-join-threads threads main_thread))
  (format t "~%")
)
