Fix pointer unchecked issue in thread-mgr.c (#960)
And refine the code format of thread_manager.h
This commit is contained in:
@ -15,65 +15,9 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
#define WAMR_SIG_TRAP (5)
|
||||
#define WAMR_SIG_STOP (19)
|
||||
#define WAMR_SIG_TERM (15)
|
||||
#define WAMR_SIG_SINGSTEP (0x1ff)
|
||||
|
||||
#define STATUS_RUNNING (0)
|
||||
#define STATUS_STOP (1)
|
||||
#define STATUS_EXIT (2)
|
||||
#define STATUS_STEP (3)
|
||||
|
||||
#define IS_WAMR_TERM_SIG(signo) ((signo) == WAMR_SIG_TERM)
|
||||
|
||||
#define IS_WAMR_STOP_SIG(signo) \
|
||||
((signo) == WAMR_SIG_STOP || (signo) == WAMR_SIG_TRAP)
|
||||
|
||||
typedef struct WASMCurrentEnvStatus {
|
||||
uint64 signal_flag : 32;
|
||||
uint64 step_count : 16;
|
||||
uint64 running_status : 16;
|
||||
korp_mutex wait_lock;
|
||||
korp_cond wait_cond;
|
||||
} WASMCurrentEnvStatus;
|
||||
|
||||
typedef struct WASMDebugInstance WASMDebugInstance;
|
||||
|
||||
WASMCurrentEnvStatus *
|
||||
wasm_cluster_create_exenv_status();
|
||||
|
||||
void
|
||||
wasm_cluster_destroy_exenv_status(WASMCurrentEnvStatus *status);
|
||||
|
||||
void
|
||||
wasm_cluster_send_signal_all(WASMCluster *cluster, uint32 signo);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_stopped(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_wait_thread_status(WASMExecEnv *exec_env, uint32 *status);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_exited(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_continue(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_send_signal(WASMExecEnv *exec_env, uint32 signo);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_step(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_set_debug_inst(WASMCluster *cluster, WASMDebugInstance *inst);
|
||||
|
||||
#endif
|
||||
typedef struct WASMCluster {
|
||||
struct WASMCluster *next;
|
||||
@ -183,6 +127,65 @@ void
|
||||
wasm_cluster_spread_custom_data(WASMModuleInstanceCommon *module_inst,
|
||||
void *custom_data);
|
||||
|
||||
#if WASM_ENABLE_DEBUG_INTERP != 0
|
||||
#define WAMR_SIG_TRAP (5)
|
||||
#define WAMR_SIG_STOP (19)
|
||||
#define WAMR_SIG_TERM (15)
|
||||
#define WAMR_SIG_SINGSTEP (0x1ff)
|
||||
|
||||
#define STATUS_RUNNING (0)
|
||||
#define STATUS_STOP (1)
|
||||
#define STATUS_EXIT (2)
|
||||
#define STATUS_STEP (3)
|
||||
|
||||
#define IS_WAMR_TERM_SIG(signo) ((signo) == WAMR_SIG_TERM)
|
||||
|
||||
#define IS_WAMR_STOP_SIG(signo) \
|
||||
((signo) == WAMR_SIG_STOP || (signo) == WAMR_SIG_TRAP)
|
||||
|
||||
typedef struct WASMCurrentEnvStatus {
|
||||
uint64 signal_flag : 32;
|
||||
uint64 step_count : 16;
|
||||
uint64 running_status : 16;
|
||||
korp_mutex wait_lock;
|
||||
korp_cond wait_cond;
|
||||
} WASMCurrentEnvStatus;
|
||||
|
||||
WASMCurrentEnvStatus *
|
||||
wasm_cluster_create_exenv_status();
|
||||
|
||||
void
|
||||
wasm_cluster_destroy_exenv_status(WASMCurrentEnvStatus *status);
|
||||
|
||||
void
|
||||
wasm_cluster_send_signal_all(WASMCluster *cluster, uint32 signo);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_stopped(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_waiting_run(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_wait_thread_status(WASMExecEnv *exec_env, uint32 *status);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_exited(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_continue(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_send_signal(WASMExecEnv *exec_env, uint32 signo);
|
||||
|
||||
void
|
||||
wasm_cluster_thread_step(WASMExecEnv *exec_env);
|
||||
|
||||
void
|
||||
wasm_cluster_set_debug_inst(WASMCluster *cluster, WASMDebugInstance *inst);
|
||||
|
||||
#endif /* end of WASM_ENABLE_DEBUG_INTERP != 0 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user