tokio is needed by both temporal & gcloud pubsub, so make just one instance for the whole library, add init/shutdown functions for it exposed to C

This commit is contained in:
Grant Limberg 2025-08-07 11:28:22 -07:00
parent 4b3b847c7f
commit 837f15d01b
5 changed files with 65 additions and 16 deletions

View file

@ -67,6 +67,8 @@ CV1::CV1(const Identity& myId, const char* path, int listenPort, RedisConfig* rc
auto span = tracer->StartSpan("cv1::CV1");
auto scope = tracer->WithActiveSpan(span);
rustybits::init_async_runtime();
char myAddress[64];
_myAddressStr = myId.address().toString(myAddress);
_connString = std::string(path);
@ -157,6 +159,8 @@ CV1::~CV1()
_smee = NULL;
}
rustybits::shutdown_async_runtime();
_run = 0;
std::this_thread::sleep_for(std::chrono::milliseconds(100));