report-json-serializer: app and top serializers
[apps/native/ttsd-worker-task.git] / src / worker.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://floralicense.org/license/
9  *
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.
15  */
16
17 #ifndef __WORKER_H_
18 #define __WORKER_H_
19
20 #include "task.h"
21
22 /**
23  * @brief The worker structure.
24  */
25 typedef struct worker worker_t;
26
27 /**
28  * @brief Creates the worker.
29  */
30 worker_t *worker_create();
31
32 /**
33  * @brief Destroys the worker.
34  */
35 void worker_destroy(worker_t *worker);
36
37 /**
38  * @brief Syncs the worker.
39  * @remarks Function blocks until all current tasks are finished.
40  */
41 void worker_sync(worker_t *worker);
42
43 /**
44  * @brief Sets maximum number of threads that the worker can use.
45  * @param[in] worker Worker reference.
46  * @param[in] max_threads Maximum number of threads that worker can use.
47  */
48 void worker_set_max_num_of_threads(worker_t *worker, int max_threads);
49
50 /**
51  * @brief Adds new task to the task queue.
52  * @param[in] worker Worker reference.
53  * @param[in] task Task to do.
54  */
55 int worker_enqueue_task(worker_t *worker, task_t *task);
56
57 #endif