ReCodEx - Task Broker
ReCodEx is complex programmer testing solution, primary targeted to technical universities. It's highly customizable and based on modern technologies.
asynchronous_handler_wrapper Class Reference

#include <reactor.h>

+ Inheritance diagram for asynchronous_handler_wrapper:

Public Member Functions

 asynchronous_handler_wrapper (zmq::context_t &context, zmq::socket_t &async_handler_socket, reactor &reactor_ref, std::shared_ptr< handler_interface > handler)
 
 ~asynchronous_handler_wrapper ()
 
virtual void operator() (const message_container &message)
 
- Public Member Functions inherited from handler_wrapper
 handler_wrapper (reactor &reactor_ref, std::shared_ptr< handler_interface > handler)
 
virtual ~handler_wrapper ()
 

Additional Inherited Members

- Protected Attributes inherited from handler_wrapper
std::shared_ptr< handler_interfacehandler_
 
reactorreactor_
 

Detailed Description

A wrapper for reactor event handlers which calls the handler asynchronously, using ZeroMQ inprocess sockets. The handler itself runs in its own (exactly one) thread.

Definition at line 52 of file reactor.h.

Constructor & Destructor Documentation

§ asynchronous_handler_wrapper()

asynchronous_handler_wrapper::asynchronous_handler_wrapper ( zmq::context_t &  context,
zmq::socket_t &  async_handler_socket,
reactor reactor_ref,
std::shared_ptr< handler_interface handler 
)
Parameters
contextZeroMQ context used to communicate with the reactor
async_handler_socketThe socket used to communicate with our worker thread (the reactor side)
reactor_refThe reactor whcih owns the handler
handlerThe handler object

Definition at line 153 of file reactor.cpp.

§ ~asynchronous_handler_wrapper()

asynchronous_handler_wrapper::~asynchronous_handler_wrapper ( )

Destroy the handler by sending a termination message to the worker thread. The ZeroMQ connection must still work for this to function.

Definition at line 163 of file reactor.cpp.

Member Function Documentation

§ operator()()

void asynchronous_handler_wrapper::operator() ( const message_container message)
virtual

Pass a message to the handler asynchronously. The message is copied when being sent through the inprocess socket.

Parameters
messageThe message to be passed

Reimplemented from handler_wrapper.

Definition at line 173 of file reactor.cpp.


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