c_pthread_attr_t type
Constructors
- c_pthread_attr_t()
Create pthread attribute object
Methods
- .(pa:c_pthread_attr_t, attr:Str)
Get pthread attribute. Currently returns null for unknown attributes. Will throw exceptions in future. Parameters
attr One of: detachstate, guardsize, inheritsched, stacksize.
- c_pthread_attr_init(attr:c_pthread_attr_t)
Call PTHREAD_ATTR_INIT(3)
- c_pthread_create(attr:c_pthread_attr_t, start_routine:UserDefinedMethod, 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] }