mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-11-30 16:48:21 +01:00
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/*
|
|
* lib/worker/include/worker.h: -- worker threading and task
|
|
*
|
|
* Copyright (c) 2018-2026, Liu chao <lc-soft@live.cn> All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
*
|
|
* This file is part of LCUI, distributed under the MIT License found
|
|
* in the LICENSE.TXT file in the root directory of this source tree.
|
|
*/
|
|
|
|
#ifndef LIB_WORKER_INCLULDE_WORKER_H
|
|
#define LIB_WORKER_INCLULDE_WORKER_H
|
|
|
|
#include <stdbool.h>
|
|
#include "worker/common.h"
|
|
|
|
LIBWORKER_BEGIN_DECLS
|
|
|
|
typedef void (*worker_task_cb)(void *);
|
|
typedef struct worker worker_t;
|
|
typedef struct worker_task worker_task_t;
|
|
|
|
LIBWORKER_PUBLIC worker_t *worker_create(void);
|
|
|
|
LIBWORKER_PUBLIC worker_task_t *worker_post_task(worker_t *worker, void *data,
|
|
worker_task_cb task_cb,
|
|
worker_task_cb after_task_cb);
|
|
|
|
LIBWORKER_PUBLIC bool worker_cancel_task(worker_t *worker, worker_task_t *task);
|
|
|
|
LIBWORKER_PUBLIC bool worker_run(worker_t *worker);
|
|
|
|
LIBWORKER_PUBLIC int worker_run_async(worker_t *worker);
|
|
|
|
LIBWORKER_PUBLIC void worker_destroy(worker_t *worker);
|
|
|
|
LIBWORKER_END_DECLS
|
|
|
|
#endif
|