api

threadpool.ch

Declarations in threadpool.ch

1 declarationsstd

Declarations

Public only
std#
Publicnamespace
namespace std
concurrent#
Publicnamespace
namespace concurrent
hardware_threads#
Publicfunction
func hardware_threads() : usize
sleep_ms#
Publicfunction
func sleep_ms(ms : ulong) : void
spawn_native#
function
func spawn_native(entry : func(*void) : *void, arg : *void) : usize
join_native#
function
func join_native(h : usize) : void
Thread#
Publicstruct
struct Thread { var handle : usize }
join#
Publicfunction
func join(self : &Thread) : void
spawn#
Publicfunction
func spawn(entry : func(*void) : *void, arg : *void) : Thread
Promise#
Publicstruct
struct Promise<T> { var ready : bool var val : T var m : mutex var cv : condvar var future_dropped : bool }
constructor#
PublicfunctionConstructor
func constructor() : Promise
set#
Publicfunction
func set(self : &Promise, x : T) : void
delete#
function
func delete(self : *Promise) : void
Future#
Publicstruct
struct Future<T> { var p : *Promise<T> }
constructor#
PublicfunctionConstructor
func constructor(pp : *Promise<T>) : Future
get#
Publicfunction
func get(self : &Future) : T
delete#
Publicfunction
func delete(self : &Future) : void
Task#
Publicstruct
struct Task { var f : function<func() : void> }
delete#
function
func delete(self : *Task) : void
worker_main#
function
func worker_main(arg : *void) : *void
PoolData#
Publicstruct
struct PoolData { var m : mutex var cv : condvar var q : vector<Task> var workers : vector<usize> var run : bool }
submit#
Publicfunction
func submit<T>(self : &PoolData, f : function<func() : T>) : Future<T>
submit_void#
Publicfunction
func submit_void(self : &PoolData, f : function<func() : void>) : void
delete#
Publicfunction
func delete(self : &PoolData) : void
ThreadPool#
Publicstruct
struct ThreadPool { var data : *PoolData }
just a wrapper around pool data that automatically
submit#
Publicfunction
func submit<T>(self : &ThreadPool, f : function<func() : T>) : Future<T>
submit_void#
Publicfunction
func submit_void(self : &ThreadPool, f : function<func() : void>) : void
delete#
Publicfunction
func delete(self : &ThreadPool) : void
create_pool#
Publicfunction
func create_pool(n : uint) : ThreadPool