Permalink
Browse files

Add linear cloptr version of task_spawn

  • Loading branch information...
1 parent c035943 commit 1a4ff077a3a36856a39c57ad24e961de58e551a3 @doublec committed Jul 18, 2012
Showing with 10 additions and 0 deletions.
  1. +6 −0 DATS/task.dats
  2. +4 −0 SATS/task.sats
View
6 DATS/task.dats
@@ -9,6 +9,8 @@ staload _ = "libats/DATS/linqueue_arr.dats"
staload _ = "prelude/DATS/array.dats"
staload _ = "libats/ngc/DATS/deque_arr.dats"
+staload "prelude/SATS/unsafe.sats"
+
%{^
#include <ucontext.h>
@@ -263,6 +265,10 @@ implement task_schedule (tsk) = {
}
implement task_spawn (ss, func) = task_schedule (task_create (ss, func))
+implement task_spawn_lin (ss, func) = task_schedule (task_create (ss, __cast(func))) where {
+ extern castfn __cast (f: task_fn_lin): task_fn
+ }
+
implement task_yield () = {
val (pff_sch | sch) = get_global_scheduler ()
View
4 SATS/task.sats
@@ -45,10 +45,14 @@ fun global_scheduler_resume (): void
fun global_scheduler_queue_task (tsk: task): void
viewtypedef task_fn = () -<cloptr1> void
+viewtypedef task_fn_lin = () -<lincloptr1> void
+
fun task_create {n:nat} (stack_size: size_t n, func: task_fn): [l:agz] task l
fun task_free {l:agz} (tsk: task l): void
fun task_schedule {l:agz} (tsk: task l): void
fun task_spawn {n:nat} (stack_size: size_t n, func: task_fn): void
+fun task_spawn_lin {n:nat} (stack_size: size_t n, func: task_fn_lin): void
+
fun task_yield (): void
fun task_queue_count ():<> size_t

0 comments on commit 1a4ff07

Please sign in to comment.