LMMC
Lamina Mathematic core
Toggle main menu visibility
载入中...
搜索中...
未找到
init.c
浏览该文件的文档.
1
5
#include "
lmmc/init.h
"
6
7
#include <lmmp.h>
8
9
static
_Thread_local
size_t
lmmc_lifecycle_depth = 0;
10
11
lmmc_status_t
lmmc_init
(
void
) {
12
if
(lmmc_lifecycle_depth == SIZE_MAX) {
13
return
LMMC_STATUS_REFERENCE_LIMIT
;
14
}
15
if
(lmmc_lifecycle_depth == 0) {
16
lmmp_global_init();
17
}
18
++lmmc_lifecycle_depth;
19
return
LMMC_STATUS_OK
;
20
}
21
22
lmmc_status_t
lmmc_deinit
(
void
) {
23
if
(lmmc_lifecycle_depth == 0) {
24
return
LMMC_STATUS_NOT_INITIALIZED
;
25
}
26
--lmmc_lifecycle_depth;
27
if
(lmmc_lifecycle_depth == 0) {
28
lmmp_global_deinit();
29
}
30
return
LMMC_STATUS_OK
;
31
}
32
33
lmmc_status_t
lmmc_stack_reset
(
size_t
size) {
34
if
(lmmc_lifecycle_depth == 0) {
35
return
LMMC_STATUS_NOT_INITIALIZED
;
36
}
37
if
(lmmc_lifecycle_depth != 1) {
38
return
LMMC_STATUS_BUSY
;
39
}
40
if
(lmmp_stack_deinit() != 0) {
41
return
LMMC_STATUS_NOT_INITIALIZED
;
42
}
43
if
(lmmp_stack_init(size) != 0) {
44
return
LMMC_STATUS_NOT_INITIALIZED
;
45
}
46
return
LMMC_STATUS_OK
;
47
}
init.h
LMMC 当前线程的初始化与底层栈管理接口.
lmmc_stack_reset
lmmc_status_t lmmc_stack_reset(size_t pool_size)
Reset the current thread's LMMP temporary-stack capacity.
定义
init.c:33
lmmc_deinit
lmmc_status_t lmmc_deinit(void)
Release one lifecycle lease owned by the current thread.
定义
init.c:22
lmmc_init
lmmc_status_t lmmc_init(void)
获取当前线程的 LMMC 生命周期租约.
定义
init.c:11
lmmc_status_t
lmmc_status_t
LMMC 库统一返回的状态码.
定义
status.h:22
LMMC_STATUS_REFERENCE_LIMIT
@ LMMC_STATUS_REFERENCE_LIMIT
定义
status.h:42
LMMC_STATUS_OK
@ LMMC_STATUS_OK
定义
status.h:23
LMMC_STATUS_BUSY
@ LMMC_STATUS_BUSY
定义
status.h:41
LMMC_STATUS_NOT_INITIALIZED
@ LMMC_STATUS_NOT_INITIALIZED
定义
status.h:40
src
init.c
生成于
, 为 LMMC使用
1.18.0