RTI Connext C# API Version 7.7.0
Rti.Dds.Core.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. This is only required on platforms that do not support automatic thread-specific storage (TSS) cleanup. Refer to the Platform Notes to see if your platform supports automatic TSS cleanup. It will be mentioned in the 'Thread Configuration' sub-section of the platform you are using.

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

Member Function Documentation

◆ Dispose()

void Rti.Dds.Core.ThreadContext.Dispose ( )

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

This method should be called last in the thread. This is only required on platforms that do not support automatic thread-specific storage (TSS) cleanup. Refer to the Platform Notes to see if your platform supports automatic TSS cleanup. It will be mentioned in the 'Thread Configuration' sub-section of the platform you are using.

See Unregistering Threads, in the Core Libraries User's Manual, for the equivalent API call in each of the supported language bindings.