rodbus (C++ API) 1.3.1
Loading...
Searching...
No Matches
rodbus::Runtime Class Reference

Handle to the underlying runtime. More...

#include <rodbus.hpp>

Public Member Functions

 Runtime (Runtime &&other) noexcept
 Transfer ownership of the underlying C-type to this instance and invalidate the other instance. More...
 
 Runtime (const RuntimeConfig &config)
 Creates a new runtime for running the protocol stack. More...
 
 ~Runtime ()
 Destroy a runtime. More...
 
void set_shutdown_timeout (std::chrono::steady_clock::duration timeout)
 By default, when the runtime shuts down, it does so without a timeout and waits indefinitely for all spawned tasks to yield. More...
 

Friends

class CppRuntimeFriend
 

Detailed Description

Handle to the underlying runtime.

Constructor & Destructor Documentation

◆ Runtime() [1/2]

rodbus::Runtime::Runtime ( Runtime &&  other)
inlinenoexcept

Transfer ownership of the underlying C-type to this instance and invalidate the other instance.

Note
the moved class will now throw an exception if any method is called
Parameters
otherClass from which ownership will be transfer to this instance

◆ Runtime() [2/2]

rodbus::Runtime::Runtime ( const RuntimeConfig config)

Creates a new runtime for running the protocol stack.

Warning
The runtime should be kept alive for as long as it's needed and it should be released with Runtime::~Runtime()
Parameters
configRuntime configuration
Exceptions
ParamException

◆ ~Runtime()

rodbus::Runtime::~Runtime ( )

Destroy a runtime.

This method will gracefully wait for all asynchronous operation to end before returning

Member Function Documentation

◆ set_shutdown_timeout()

void rodbus::Runtime::set_shutdown_timeout ( std::chrono::steady_clock::duration  timeout)

By default, when the runtime shuts down, it does so without a timeout and waits indefinitely for all spawned tasks to yield.

Setting this value will put a maximum time bound on the eventual shutdown. Threads that have not exited within this timeout will be terminated.

Warning
This can leak memory. This method should only be used if the the entire application is being shut down so that memory can be cleaned up by the OS.
Parameters
timeoutMaximum number of seconds to wait for the runtime to shut down

The documentation for this class was generated from the following file: