dm: support iothread

Supply a decidate thread, which can moniter a set of fds with epoll,
when the data is ready, call the corresponding callback.

This iothread will be created automatically with the first successful
call to iothread_add,  and will be destroyed in iothread_deinit if it
was created.

Note, currenlty only support one iothread.

Tracked-On: #7940
Signed-off-by: Conghui <conghui.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Conghui
2022-07-15 18:42:08 +08:00
committed by acrnsi-robot
parent 670ccf21f8
commit 4fd0a1900a
4 changed files with 188 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
/* Copyright (C) 2022 Intel Corporation.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef _iothread_CTX_H_
#define _iothread_CTX_H_
struct iothread_mevent {
void (*run)(void *);
void *arg;
};
int iothread_add(int fd, struct iothread_mevent *aevt);
int iothread_del(int fd);
int iothread_init(void);
void iothread_deinit(void);
#endif