我要评分
获取效率
正确性
完整性
易理解

HTL_thread_create

Creates a thread.

Interface Definition

int HTL_thread_create(HTL_thread_t *thread, const HTL_thread_attr_t *thread_attr, void *(*thread_func)(void *), void *thread_args);

Description

HTL_thread_create() creates a ULT and returns its handle through thread. HTL automatically binds the created ULT to a thread pool. thread must be explicitly released by HTL_thread_free().

This function applies only to the HTL-PThreads parallel programming mode.

Parameters

Parameter

Type

Description

Input/Output

thread

HTL_thread_t *

Handle to the ULT.

Output

thread_attr

HTL_thread_attr_t *

ULT attribute.

Input

thread_func

void* (*thread_func)(void *)

New ULT execution function.

Input

thread_args

void *

Input parameter of thread_func.

Input

Return Value

  • HTL_THREAD_SUCCESS: success.
  • Other values: failure. For details, see the error code descriptions.

Example

1
2
3
4
5
    /* Create Thread */
    for (i = 0; i < num_threads; i++) {
        arg[i] = i;
        ret = HTL_thread_create(&threads[i], NULL, thread_create, &arg[i]);
    }