dxd - dynax driver framework 2.7.0d222
cross platform open source driver development framework
Loading...
Searching...
No Matches
dx::pipe< rcv_t >::server< instance_t, arg_t > Class Template Reference

server - accepts multiple concurrent pipe client connections Each accepted connection is served by its own pipe::server::instance, running on a dedicated read thread. run() keeps exactly one instance listening for the next client at all times: once ConnectNamedPipe() accepts a connection, that instance's own thread calls server::run() again - reaping already-concluded instances and spawning the next listener - before servicing its own connection. A concluded instance (client disconnected) therefore joins only at the start of the next run(), on a different thread: a std::jthread cannot join itself, so reaping cannot happen from within the concluding instance's own read thread. An otherwise idle server thus keeps its most recently used instance around until either the next connection or stop(), which unconditionally joins every instance - connected or not - synchronously before returning. More...

#include <dx_pipe.h>

Collaboration diagram for dx::pipe< rcv_t >::server< instance_t, arg_t >:

Classes

struct  access
class  instance

Public Member Functions

 dx_catchall_rethrow () void stop() noexcept
template<typename snd_t>
const snd_t & operator<< (const snd_t &snd) try
void run () try
 server (const std::string &id, arg_t... args)
 server (const std::string &id, const ::DWORD(&access)[2], arg_t... args)
 server (const std::string &id, typename decltype(listen)::listeners &&listeners, arg_t... args)
 server (const std::string &id, typename decltype(listen)::listeners &&listeners, const ::DWORD(&access)[2], arg_t... args)
 ~server ()

Public Attributes

std::tuple< arg_t... > args
dx::listen< std::function< void(class instance &, const rcv_t &)> > listen

Protected Attributes

::DWORD access [2] {}
std::string id
shared::guard< std::set< std::shared_ptr< class instance > > > instance
std::atomic< bool > stopping {}

Detailed Description

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
class dx::pipe< rcv_t >::server< instance_t, arg_t >

server - accepts multiple concurrent pipe client connections Each accepted connection is served by its own pipe::server::instance, running on a dedicated read thread. run() keeps exactly one instance listening for the next client at all times: once ConnectNamedPipe() accepts a connection, that instance's own thread calls server::run() again - reaping already-concluded instances and spawning the next listener - before servicing its own connection. A concluded instance (client disconnected) therefore joins only at the start of the next run(), on a different thread: a std::jthread cannot join itself, so reaping cannot happen from within the concluding instance's own read thread. An otherwise idle server thus keeps its most recently used instance around until either the next connection or stop(), which unconditionally joins every instance - connected or not - synchronously before returning.

Constructor & Destructor Documentation

◆ server() [1/4]

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::server ( const std::string & id,
typename decltype(listen)::listeners && listeners,
const ::DWORD(&) access[2],
arg_t... args )
inline
Here is the caller graph for this function:

◆ server() [2/4]

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::server ( const std::string & id,
typename decltype(listen)::listeners && listeners,
arg_t... args )
inline
Here is the call graph for this function:

◆ server() [3/4]

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::server ( const std::string & id,
const ::DWORD(&) access[2],
arg_t... args )
inline
Here is the call graph for this function:

◆ server() [4/4]

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::server ( const std::string & id,
arg_t... args )
inline
Here is the call graph for this function:

◆ ~server()

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::~server ( )
inline

Member Function Documentation

◆ dx_catchall_rethrow()

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::pipe< rcv_t >::server< instance_t, arg_t >::dx_catchall_rethrow ( )
inlinenoexcept

◆ operator<<()

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
template<typename snd_t>
const snd_t & dx::pipe< rcv_t >::server< instance_t, arg_t >::operator<< ( const snd_t & snd)
inline

◆ run()

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
void dx::pipe< rcv_t >::server< instance_t, arg_t >::run ( )
inline
Here is the caller graph for this function:

Member Data Documentation

◆ access

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
::DWORD dx::pipe< rcv_t >::server< instance_t, arg_t >::access[2] {}
protected

◆ args

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
std::tuple<arg_t...> dx::pipe< rcv_t >::server< instance_t, arg_t >::args

◆ id

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
std::string dx::pipe< rcv_t >::server< instance_t, arg_t >::id
protected

◆ instance

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
shared::guard<std::set<std::shared_ptr<class instance> > > dx::pipe< rcv_t >::server< instance_t, arg_t >::instance
protected

◆ listen

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
dx::listen<std::function<void(class instance&, const rcv_t&)> > dx::pipe< rcv_t >::server< instance_t, arg_t >::listen

◆ stopping

template<typename rcv_t>
template<typename instance_t = pipe, typename ... arg_t>
std::atomic<bool> dx::pipe< rcv_t >::server< instance_t, arg_t >::stopping {}
protected

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

(c) copyright 2009 dynamic acoustics e.U. generated on

a closed source license may be obtained by requesting a written permission from dynamic acoustics e.U.
however - governmental use generally and military use especially is strictly prohibited though.