2 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.1 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 * @brief Worker structure.
25 typedef struct worker worker_t;
28 * @brief Worker mode enumeration.
30 typedef enum worker_mode
33 * @brief In this mode worker busy to idle proportion is low.
38 * @brief In this mode worker busy to idle proportion is balanced.
43 * @brief In this mode worker busy to idle proportion is high.
49 * @brief Creates worker.
51 worker_t *worker_create();
54 * @brief Destroys worker.
56 void worker_destroy();
59 * @brief Sets maximum number of threads that worker can use.
60 * @param[in] worker Worker reference.
61 * @param[in] max_threads Maximum number of threads that worker can use.
63 void worker_set_max_num_of_threads(worker_t *worker, int max_threads);
66 * @brief Adds new task to task queue.
67 * @param[in] worker Worker reference.
68 * @param[in] task Task to do.
70 int worker_enqueue_task(worker_t *worker, task_t task);
73 * @brief Sets worker mode.
74 * @param[in] worker Worker reference.
76 void worker_set_mode(worker_t *worker, worker_mode_e mode);
79 * @brief Gets worker mode.
80 * @param[in] worker Worker reference.
82 worker_mode_e worker_get_mode(worker_t *worker);