TizenRT Public API
v2.0 M2
|
Provides APIs for Task Manager. More...
Files | |
file | task_manager.h |
file | task_manager_broadcast_list.h |
User specific broadcast messages are declared at this file. | |
Data Structures | |
struct | tm_appinfo_s |
Application Info Structure. More... | |
struct | tm_appinfo_list_s |
struct | tm_msg_s |
Unicast message Structure. More... | |
Macros | |
#define | TM_APP_STATE_RUNNING (1) |
Task State which managed by Task Manager. More... | |
#define | TM_APP_PERMISSION_ALL (0) |
Task Permission. More... | |
#define | TM_NO_RESPONSE (0) |
Returnable Flag from Task Manager. More... | |
Typedefs | |
typedef void(* | _tm_unicast_t) (tm_msg_t *) |
Unicast callback function type. More... | |
typedef void(* | _tm_broadcast_t) (void *, void *) |
Broadcast callback function type. More... | |
typedef void(* | _tm_termination_t) (void *) |
Termination callback function type. More... | |
Enumerations |
Functions | |
int | task_manager_register_builtin (char *name, int permission, int timeout) |
Request to register a built-in task. More... | |
int | task_manager_register_task (char *name, int priority, int stack_size, main_t entry, char *argv[], int permission, int timeout) |
Request to register a task which is not in built-in list. More... | |
int | task_manager_register_pthread (char *name, pthread_attr_t *attr, pthread_startroutine_t start_routine, pthread_addr_t arg, int permission, int timeout) |
Request to register a pthread which is not in built-in list. More... | |
int | task_manager_unregister (int handle, int timeout) |
Request to unregister a task. More... | |
int | task_manager_start (int handle, int timeout) |
Request to start the task. More... | |
int | task_manager_stop (int handle, int timeout) |
Request to stop the task. More... | |
int | task_manager_pause (int handle, int timeout) |
Request to pause the task. More... | |
int | task_manager_resume (int handle, int timeout) |
Request to resume the task. More... | |
int | task_manager_restart (int handle, int timeout) |
Request to restart the task. More... | |
int | task_manager_unicast (int handle, tm_msg_t *send_msg, tm_msg_t *reply_msg, int timeout) |
Request to send messages to the task. More... | |
int | task_manager_broadcast (int msg, tm_msg_t *data, int timeout) |
Request to send messages to the tasks. More... | |
int | task_manager_set_unicast_cb (void(*func)(tm_msg_t *data)) |
Set unicast callback function API. More... | |
int | task_manager_set_broadcast_cb (int msg, void(*func)(void *user_data, void *data), tm_msg_t *cb_data) |
Register callback function which will be used for processing a certain received broadcast message. More... | |
int | task_manager_set_exit_cb (void(*func)(void *data), tm_msg_t *cb_data) |
Set callback function called when task terminates normally. More... | |
int | task_manager_set_stop_cb (void(*func)(void *data), tm_msg_t *cb_data) |
Set callback function called when task is stopped by task manager. More... | |
tm_appinfo_list_t * | task_manager_getinfo_with_name (char *name, int timeout) |
Get task information list through task name. More... | |
tm_appinfo_t * | task_manager_getinfo_with_handle (int handle, int timeout) |
Get task information through handle. More... | |
tm_appinfo_list_t * | task_manager_getinfo_with_group (int group, int timeout) |
Get task information list through group. More... | |
tm_appinfo_t * | task_manager_getinfo_with_pid (int pid, int timeout) |
Get the handle through pid. More... | |
void | task_manager_clean_info (tm_appinfo_t **info) |
Clean task information. More... | |
void | task_manager_clean_infolist (tm_appinfo_list_t **info_list) |
Clean task information list. More... | |
int | task_manager_reply_unicast (tm_msg_t *reply_msg) |
Send unicast reply message. More... | |
int | task_manager_alloc_broadcast_msg (void) |
Allocate a new broadcast message which is not defined in the <task_manager/task_manager.h> and <task_manager/task_manager_broadcast_list.h> More... | |
int | task_manager_unset_broadcast_cb (int msg, int timeout) |
Unregister callback function which was used for a certain broadcast message. More... | |
int | task_manager_dealloc_broadcast_msg (int msg, int timeout) |
Remove the broadcast message which was allocated by using task_manager_alloc_broadcast_msg() API. More... | |
Provides APIs for Task Manager.
#define TM_APP_PERMISSION_ALL (0) |
Task Permission.
TM_APP_PERMISSION_ALL : Any Task can request the control to Task Manager TM_APP_PERMISSION_GROUP : Only same group task can request the control to Task Manager -> group : Tasks set which registered from same parent task TM_APP_PERMISSION_DEDICATE : Only a task which requested to register that task can request the control to Task Manager
Definition at line 54 of file task_manager.h.
#define TM_APP_STATE_RUNNING (1) |
Task State which managed by Task Manager.
Definition at line 40 of file task_manager.h.
#define TM_NO_RESPONSE (0) |
Returnable Flag from Task Manager.
These defined can be used in timeout argument for most of the task manager APIs.
If timeout argument is greater than 0, its API will wait to receive during timeout milliseconds.
Definition at line 63 of file task_manager.h.
typedef void(* _tm_broadcast_t) (void *, void *) |
Broadcast callback function type.
Definition at line 140 of file task_manager.h.
typedef void(* _tm_termination_t) (void *) |
Termination callback function type.
Definition at line 145 of file task_manager.h.
typedef void(* _tm_unicast_t) (tm_msg_t *) |
Unicast callback function type.
Definition at line 135 of file task_manager.h.
Broadcast message list.
These values can be used for broadcast messages.
If user wants to add some other types of broadcast message,
user can add their own broadcast messages at <task_manager/task_manager_broadcast_list.h>.
Definition at line 97 of file task_manager.h.
enum tm_result_error_e |
Error Type of Result Value returned from Task Manager.
If operation is failed, these defined values will be returned.
Definition at line 70 of file task_manager.h.
int task_manager_alloc_broadcast_msg | ( | void | ) |
Allocate a new broadcast message which is not defined in the <task_manager/task_manager.h>
and <task_manager/task_manager_broadcast_list.h>
#include <task_manager/task_manager.h>
int task_manager_broadcast | ( | int | msg, |
tm_msg_t * | data, | ||
int | timeout | ||
) |
Request to send messages to the tasks.
#include <task_manager/task_manager.h>
[in] | msg | message structure to be unicasted |
[in] | data | data and its size to be broadcasted |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
void task_manager_clean_info | ( | tm_appinfo_t ** | info | ) |
Clean task information.
#include <task_manager/task_manager.h>
[in] | info | the task information |
void task_manager_clean_infolist | ( | tm_appinfo_list_t ** | info_list | ) |
Clean task information list.
#include <task_manager/task_manager.h>
[in] | info_list | the task information list |
int task_manager_dealloc_broadcast_msg | ( | int | msg, |
int | timeout | ||
) |
Remove the broadcast message which was allocated by using task_manager_alloc_broadcast_msg() API.
#include <task_manager/task_manager.h>
[in] | msg | the message which to be removed. |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
tm_appinfo_list_t* task_manager_getinfo_with_group | ( | int | group, |
int | timeout | ||
) |
Get task information list through group.
#include <task_manager/task_manager.h> After using the list of task information, use task_manager_clean_infolist() API to free the allocated memory.
[in] | group | the group id to get information |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
tm_appinfo_t* task_manager_getinfo_with_handle | ( | int | handle, |
int | timeout | ||
) |
Get task information through handle.
#include <task_manager/task_manager.h> After using the task information, use task_manager_clean_info() API to free the allocated memory.
[in] | handle | the handle id to get information |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
tm_appinfo_list_t* task_manager_getinfo_with_name | ( | char * | name, |
int | timeout | ||
) |
Get task information list through task name.
#include <task_manager/task_manager.h> After using the list of task information, use task_manager_clean_infolist() API to free the allocated memory.
[in] | name | the task name to get information |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
tm_appinfo_t* task_manager_getinfo_with_pid | ( | int | pid, |
int | timeout | ||
) |
Get the handle through pid.
#include <task_manager/task_manager.h>
[in] | pid | the pid which to get its task information |
[in] | timeout | returnable flag. It can be one of the below. TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds For this API, timeout cannot be set to TM_NO_RESPONSE. |
int task_manager_pause | ( | int | handle, |
int | timeout | ||
) |
Request to pause the task.
#include <task_manager/task_manager.h>
[in] | handle | the handle id of task to be paused |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_register_builtin | ( | char * | name, |
int | permission, | ||
int | timeout | ||
) |
Request to register a built-in task.
#include <task_manager/task_manager.h>
This API can request to register a built-in task.
Find apps/builtin/README.md to know how to use built-in task.
[in] | name | the name of task to be registered |
[in] | permission | the permission of task to be registered |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_register_pthread | ( | char * | name, |
pthread_attr_t * | attr, | ||
pthread_startroutine_t | start_routine, | ||
pthread_addr_t | arg, | ||
int | permission, | ||
int | timeout | ||
) |
Request to register a pthread which is not in built-in list.
#include <task_manager/task_manager.h>
[in] | name | the name of pthread to be registered |
[in] | attr | the attribute of pthread to be registered |
[in] | start_routine | the entry function pointer |
[in] | arg | the argument to pass when task creation |
[in] | permission | the permission of task to be registered |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_register_task | ( | char * | name, |
int | priority, | ||
int | stack_size, | ||
main_t | entry, | ||
char * | argv[], | ||
int | permission, | ||
int | timeout | ||
) |
Request to register a task which is not in built-in list.
#include <task_manager/task_manager.h>
Find apps/builtin/README.md to know how to use built-in task.
[in] | name | the name of task to be registered |
[in] | priority | the priority of task to be registered |
[in] | stack_size | the stack_size of task to be registered |
[in] | entry | the entry function pointer |
[in] | argv | the argument to pass when task creation |
[in] | permission | the permission of task to be registered |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_reply_unicast | ( | tm_msg_t * | reply_msg | ) |
Send unicast reply message.
#include <task_manager/task_manager.h>
[in] | reply_msg | the pointer of msg for reply |
int task_manager_restart | ( | int | handle, |
int | timeout | ||
) |
Request to restart the task.
#include <task_manager/task_manager.h> It cannot guarantee the resource de-allocation.
[in] | handle | the handle id of task to be restarted |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_resume | ( | int | handle, |
int | timeout | ||
) |
Request to resume the task.
#include <task_manager/task_manager.h>
[in] | handle | the handle id of task to be resumed |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_set_broadcast_cb | ( | int | msg, |
void(*)(void *user_data, void *data) | func, | ||
tm_msg_t * | cb_data | ||
) |
Register callback function which will be used for processing a certain received broadcast message.
#include <task_manager/task_manager.h>
[in] | msg | a certain broadcast message. When this message is received, the callback function func is called. Pre defined broadcast messages are presented at the top of <task_manager/task_manager.h>. User can add pre defined broadcast messages at the <task_manager/task_manager_broadcast_list.h> If this message is not pre defined at the <task_manager/task_manager.h> and <task_manager/task_manager_broadcast_list.h>, user should use task_manager_alloc_broadcast_msg() API to get a new broadacast message. |
[in] | func | the callback function which will be called when a msg is received. |
[in] | cb_data | a message structure to pass to the callback function func. |
int task_manager_set_exit_cb | ( | void(*)(void *data) | func, |
tm_msg_t * | cb_data | ||
) |
Set callback function called when task terminates normally.
#include <task_manager/task_manager.h>
[in] | func | the callback function that is called when the task or thread terminates normally. |
[in] | cb_data | a data pointer to pass to the callback function func. |
int task_manager_set_stop_cb | ( | void(*)(void *data) | func, |
tm_msg_t * | cb_data | ||
) |
Set callback function called when task is stopped by task manager.
#include <task_manager/task_manager.h>
[in] | func | the callback function that is called when the task or thread is stopped by task manager. |
[in] | cb_data | a data pointer to pass to the callback function func. |
int task_manager_set_unicast_cb | ( | void(*)(tm_msg_t *data) | func | ) |
Set unicast callback function API.
#include <task_manager/task_manager.h>
[in] | func | the callback function which handle the msg |
int task_manager_start | ( | int | handle, |
int | timeout | ||
) |
Request to start the task.
#include <task_manager/task_manager.h>
[in] | handle | the handle id of task to be started |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_stop | ( | int | handle, |
int | timeout | ||
) |
Request to stop the task.
#include <task_manager/task_manager.h>
[in] | handle | the handle id of task to be stopped. |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
Request to send messages to the task.
#include <task_manager/task_manager.h>
task_manager_unicast can be used with SYNC and ASYNC mode.
With SYNC mode, reply msg can be sent through task_manager_reply_unicast API.
[in] | handle | the handle id of task to be sent |
[in] | send_msg | message structure to be unicasted |
[out] | reply_msg | the reply msg structure for sync. If this is NULL, task_manager_unicast works asynchronously. |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds If reply is not NULL(=SYNC), timeout should not be set to TM_NO_RESPONSE. When you enable CONFIG_TASK_MANAGER_UNICAST_REPLY_TIMEOUT with non-zero value, task manager waits the reply during CONFIG_TASK_MANAGER_UNICAST_REPLY_TIMEOUT even if user calls this API with TM_RESPONSE_WAIT_INF. When set to zero, task manager waits the reply forever, it can cause task manager hang. |
int task_manager_unregister | ( | int | handle, |
int | timeout | ||
) |
Request to unregister a task.
#include <task_manager/task_manager.h>
[in] | handle | the handle id of task to be unregistered |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |
int task_manager_unset_broadcast_cb | ( | int | msg, |
int | timeout | ||
) |
Unregister callback function which was used for a certain broadcast message.
#include <task_manager/task_manager.h>
[in] | msg | the broadcast message corresponding to the callback function to be unregistered |
[in] | timeout | returnable flag. It can be one of the below. TM_NO_RESPONSE : Ignore the response of request from task manager TM_RESPONSE_WAIT_INF : Blocked until get the response from task manager integer value : Specifies an upper limit on the time for which will block in milliseconds |