RTI Connext C# API  6.1.2
ThreadContext Class Reference

Utility that cleans up memory used by Connext on the thread. More...

Inherits IDisposable.

Public Member Functions

void Dispose ()
 Disposes ThreadContext, releasing memory used by Connext on the thread. More...
 

Detailed Description

Utility that cleans up memory used by Connext on the thread.

Use ServiceEnvironment.GetThreadContext() to obtain an instance of this type in a thread function before any Connext API is called. The disposal of said instance will ensure memory used by Connext on the thread will be freed.

void myThreadFunction()
{
using (ServiceEnvironment.Instance.GetThreadContext())
{
// Use DDS API within this scope
}
}

Member Function Documentation

◆ Dispose()

void Dispose ( )

Disposes ThreadContext, releasing memory used by Connext on the thread.

This method should be called last in the thread.