Skip to content

Commit

Permalink
maybe try this again
Browse files Browse the repository at this point in the history
  • Loading branch information
pillowtrucker committed May 17, 2024
1 parent dcfb09f commit 118b85f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions cxxsrc/TheracSimulatorAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// #include <godot_cpp/variant/packed_string_array.hpp>
// #include <godot_cpp/variant/string.hpp>
// #include <gsl/gsl>
#include <mutex>
// #include <mutex>

#include <vector>
namespace TheracSimulatorAdapter {
Expand Down Expand Up @@ -86,6 +86,7 @@ auto TheracSimulatorAdapter::requestStateInfo(
::requestStateInfo(wrapped_comms, state_info_request)
);
}
/*
auto TheracSimulatorAdapter::check_malfunction() -> bool {
std::shared_lock<std::shared_mutex> lock{malfunctioning_mutex};
return malfunctioning;
Expand All @@ -98,5 +99,5 @@ auto TheracSimulatorAdapter::reset_malfunction() -> bool {
std::unique_lock<std::shared_mutex> lock{malfunctioning_mutex};
return not(malfunctioning = false);
}

*/
} // namespace TheracSimulatorAdapter
7 changes: 4 additions & 3 deletions cxxsrc/TheracSimulatorAdapter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// #endif
#include <HsFFI.h>
// #include <godot_cpp/variant/string.hpp>
#include <shared_mutex>
// #include <shared_mutex>
#include <string>

namespace TheracSimulatorAdapter {
Expand Down Expand Up @@ -57,17 +57,18 @@ class TheracSimulatorAdapter {
HsInt beam_energy = 0
);
auto requestStateInfo(StateInfoRequest state_info_request) -> std::string;
/*
auto check_malfunction() -> bool;
auto set_malfunction() -> bool;
auto reset_malfunction() -> bool;

*/
private:
static auto
hs_init(std::string const & args = "-threaded +RTS -N -RTS") -> HsStablePtr;
static void hs_exit();

void * wrapped_comms;
bool malfunctioning = false;
std::shared_mutex malfunctioning_mutex;
// std::shared_mutex malfunctioning_mutex;
};
} // namespace TheracSimulatorAdapter
2 changes: 1 addition & 1 deletion hstherac25.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ foreign-library hstherac25
random >= 1.2.1.1,
stm
other-modules: HsTherac25
-- cxx-sources: cxxsrc/TheracSimulatorAdapter.cpp
cxx-sources: cxxsrc/TheracSimulatorAdapter.cpp
-- cxx-sources: cxxsrc/TheracSimulatorAdapter.hpp, cxxsrc/TheracSimulatorAdapter.cpp
library
-- Import common warning flags.
Expand Down

0 comments on commit 118b85f

Please sign in to comment.