Context

An object that encapsulates a $(ZMQ) context.

In most programs, it is not necessary to use this type directly, as Socket will use a default global context if not explicitly provided with one. See $(FREF defaultContext) for details.

A default-initialized Context is not a valid $(ZMQ) context; it must always be explicitly initialized with $(FREF _Context.opCall):

Context ctx;        // Not a valid context yet
ctx = Context();    // ...but now it is.

Context objects can be passed around by value, and two copies will refer to the same context. The underlying context is managed using reference counting, so that when the last copy of a Context goes out of scope, the context is automatically destroyed. The reference counting is performed in a thread safe manner, so that the same context can be shared between multiple threads. ($(ZMQ) guarantees the thread safety of other context operations.)

Members

Functions

detach
void detach()

Detaches from the $(ZMQ) context.

terminate
void terminate()

Forcefully terminates the context.

Properties

handle
inout(void)* handle [@property getter]

The void* pointer used by the underlying C API to refer to the context.

initialized
bool initialized [@property getter]

Whether this Context object has been initialized, i.e. whether it refers to a valid $(ZMQ) context.

ioThreads
int ioThreads [@property getter]
int ioThreads [@property setter]

The number of I/O threads.

ipv6
bool ipv6 [@property getter]
bool ipv6 [@property setter]

IPv6 option.

maxSockets
int maxSockets [@property getter]
int maxSockets [@property setter]

The maximum number of sockets.

socketLimit
int socketLimit [@property getter]

The largest configurable number of sockets.

Static functions

opCall
Context opCall()

Creates a new $(ZMQ) context.

See Also

$(FREF defaultContext)

Meta