Methods

c_pthread_createΒΆ

c_pthread_create(attr:c_pthread_attr_t, start_routine:Closure, arg:Any)

Call PTHREAD_CREATE(3). Not recommended for direct calls, use Thread type instead.

Returns

Arr with [Int, c_pthread_t]. Int is the status returned by pthread_create(). c_pthread_t is a thin wrapper around underlying pthread_t, returned by PTHREAD_CREATE(3)

Example

F init(t:Thread, f:Fun, arg) {
	thread_attr = c_pthread_attr_t()
	c_pthread_attr_init(thread_attr)
	create_result = c_pthread_create(thread_attr, f, arg)
	code = create_result[0]
	if code {
		throw Error("Failed to c_pthread_create")
	}
	t.thread = create_result[1]
}