Skip to content

Commit

Permalink
disable ConditionalCoreSuspender on Linux
Browse files Browse the repository at this point in the history
until we can figure out why it doesn't behave properly
  • Loading branch information
myk002 committed Jan 10, 2025
1 parent e464afc commit 20cd792
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions library/Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,13 +419,17 @@ bool is_builtin(color_ostream &con, const std::string &command) {
}

void get_commands(color_ostream &con, std::vector<std::string> &commands) {
#ifdef LINUX_BUILD
CoreSuspender suspend;
#else
ConditionalCoreSuspender suspend{};

if (!suspend) {
con.printerr("Cannot acquire core lock in helpdb.get_commands\n");
commands.clear();
return;
}
#endif

auto L = DFHack::Core::getInstance().getLuaState();
Lua::StackUnwinder top(L);
Expand Down Expand Up @@ -626,12 +630,17 @@ static std::string sc_event_name (state_change_event id) {
}

void help_helper(color_ostream &con, const std::string &entry_name) {
#ifdef LINUX_BUILD
CoreSuspender suspend;
#else
ConditionalCoreSuspender suspend{};

if (!suspend) {
con.printerr("Failed Lua call to helpdb.help (could not acquire core lock).\n");
return;
}
#endif

auto L = DFHack::Core::getInstance().getLuaState();
Lua::StackUnwinder top(L);

Expand All @@ -649,7 +658,17 @@ void help_helper(color_ostream &con, const std::string &entry_name) {
}

void tags_helper(color_ostream &con, const std::string &tag) {
#ifdef LINUX_BUILD
CoreSuspender suspend;
#else
ConditionalCoreSuspender suspend{};

if (!suspend) {
con.printerr("Failed Lua call to helpdb.help (could not acquire core lock).\n");
return;
}
#endif

auto L = DFHack::Core::getInstance().getLuaState();
Lua::StackUnwinder top(L);

Expand Down Expand Up @@ -686,7 +705,17 @@ void ls_helper(color_ostream &con, const std::vector<std::string> &params) {
filter.push_back(str);
}

#ifdef LINUX_BUILD
CoreSuspender suspend;
#else
ConditionalCoreSuspender suspend{};

if (!suspend) {
con.printerr("Failed Lua call to helpdb.help (could not acquire core lock).\n");
return;
}
#endif

auto L = DFHack::Core::getInstance().getLuaState();
Lua::StackUnwinder top(L);

Expand Down

0 comments on commit 20cd792

Please sign in to comment.