Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

refactor: decouple sys_exit_type with dsn_runtime #529

Merged
merged 9 commits into from
Jul 6, 2020

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Jul 3, 2020

There are some types which are defined in dsn_runtime being used in global_config.h, so this file is coupled with dsn_runtime. And now sys_exit_type is defined in this file. So if you want to use sys_exit_type, you must coupled with dsn_runtime, which is not what we want. So in this pull request, I put sys_exit_type to a seperated file.
And remove the include of global_config.h in include/dsn/tool_api.h, which is widely included in rdsn.

@levy5307 levy5307 changed the title refactor: move sys_exit_type to a seperated file which are decoupled with dsn_runtime refactor: move sys_exit_type to a seperated file which is decoupled with dsn_runtime Jul 3, 2020
acelyc111
acelyc111 previously approved these changes Jul 4, 2020
@neverchanje neverchanje changed the title refactor: move sys_exit_type to a seperated file which is decoupled with dsn_runtime refactor: decouple sys_exit_type with dsn_runtime Jul 4, 2020
@neverchanje
Copy link
Contributor

neverchanje commented Jul 4, 2020

sys_exit_type is related to dsn::tools::sys_exit (in include/dsn/tool_api.h), which manages the hooks for system exit.

DSN_API extern join_point<void, sys_exit_type> sys_exit;
NORETURN DSN_API void dsn_exit(int code)
{
    printf("dsn exit with code %d\n", code);
    fflush(stdout);
    ::dsn::tools::sys_exit.execute(::dsn::SYS_EXIT_NORMAL);

    _exit(code);
}

You can move sys_exit_type with sys_exit to a file called include/dsn/sys_exit_hook.h to make the relationship clear.

@levy5307
Copy link
Contributor Author

levy5307 commented Jul 4, 2020

sys_exit_type is related to dsn::tools::sys_exit (in include/dsn/tool_api.h), which manages the hooks for system exit.

DSN_API extern join_point<void, sys_exit_type> sys_exit;
NORETURN DSN_API void dsn_exit(int code)
{
    printf("dsn exit with code %d\n", code);
    fflush(stdout);
    ::dsn::tools::sys_exit.execute(::dsn::SYS_EXIT_NORMAL);

    _exit(code);
}

You can move sys_exit_type with sys_exit to a file called include/dsn/sys_exit_hook.h to make the relationship clear.

Done.

@hycdong hycdong merged commit 0de9e4d into XiaoMi:master Jul 6, 2020
@levy5307 levy5307 deleted the global-config branch July 9, 2020 13:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants