X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/a5cb4cf37e5dfa9bb9ce5c5e4ccf8d5978d3576f..a500fb72810060e52d87ad2c2e4691531f0bcc5a:/projects/stargazer/plugins/other/rscript/rscript.h diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index e734227c..80fc8651 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -36,10 +36,13 @@ #include #include #include +#include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#include +#pragma GCC diagnostic pop #include -#include - namespace STG { struct Settings; @@ -200,7 +203,7 @@ private: REMOTE_SCRIPT(const REMOTE_SCRIPT & rhs); REMOTE_SCRIPT & operator=(const REMOTE_SCRIPT & rhs); - static void * Run(void *); + void Run(std::stop_token token); bool PrepareNet(); bool FinalizeNet(); @@ -215,8 +218,8 @@ private: void SetUserNotifiers(UserPtr u); void UnSetUserNotifiers(UserPtr u); - void InitEncrypt(BLOWFISH_CTX * ctx, const std::string & password) const; - void Encrypt(BLOWFISH_CTX * ctx, void * dst, const void * src, size_t len8) const; + void InitEncrypt(const std::string & password) const; + void Encrypt(void * dst, const void * src, size_t len8) const; mutable BLOWFISH_CTX ctx; @@ -230,15 +233,14 @@ private: int sendPeriod; int halfPeriod; - bool nonstop; bool isRunning; STG::Users * users; std::vector netRouters; - pthread_t thread; - pthread_mutex_t mutex; + std::jthread m_thread; + std::mutex m_mutex; int sock;