2019-07-28 10:31:56 +08:00
|
|
|
|
#ifndef ACL_MBOX_INCLUDE_H
|
2016-07-29 16:43:46 +08:00
|
|
|
|
#define ACL_MBOX_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
|
|
|
|
|
typedef struct ACL_MBOX ACL_MBOX;
|
|
|
|
|
|
2017-04-07 20:13:08 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
* @return {ACL_MBOX}
|
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API ACL_MBOX *acl_mbox_create(void);
|
2017-04-07 20:13:08 +08:00
|
|
|
|
|
2021-01-10 13:51:49 +08:00
|
|
|
|
#define ACL_MBOX_T_SPSC 0 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define ACL_MBOX_T_MPSC 1 /* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
|
|
|
|
|
ACL_API ACL_MBOX *acl_mbox_create2(unsigned type);
|
|
|
|
|
|
2017-04-07 20:13:08 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ͷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param mbox {ACL_MBOX*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param free_fn {void (*)(void*)} <EFBFBD>ǿ<EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷŵ<EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>еĶ<EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API void acl_mbox_free(ACL_MBOX *mbox, void (*free_fn)(void*));
|
2017-04-07 20:13:08 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ<EFBFBD>̬<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param mbox {ACL_MBOX*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
* @param msg {void*}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD>ͳɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -1
|
2017-04-07 20:13:08 +08:00
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API int acl_mbox_send(ACL_MBOX *mbox, void *msg);
|
2017-04-07 20:13:08 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>ȡ<EFBFBD><EFBFBD>Ϣ
|
|
|
|
|
* @param mbox {ACL_MBOX*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} <EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD><EFBFBD>뼶<EFBFBD><EFBFBD>)<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> < 0 <EFBFBD><EFBFBD>һֱ<EFBFBD>ȴ<EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param success {int*} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>ɹ<EFBFBD>
|
|
|
|
|
* @return {void*} <EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> NULL ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD> success <EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD>ж϶<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD> NULL <EFBFBD><EFBFBD>ʾ<EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
2017-04-07 20:13:08 +08:00
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API void *acl_mbox_read(ACL_MBOX *mbox, int timeout, int *success);
|
2017-04-07 20:13:08 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param mbox {ACL_MBOX*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
* @return {size_t}
|
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API size_t acl_mbox_nsend(ACL_MBOX *mbox);
|
2017-04-07 20:13:08 +08:00
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѿ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param mbox {ACL_MBOX*} <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
* @return {size_t}
|
|
|
|
|
*/
|
2016-07-29 16:43:46 +08:00
|
|
|
|
ACL_API size_t acl_mbox_nread(ACL_MBOX *mbox);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|