18 #ifndef LUNCHBOX_REQUESTHANDLER_H
19 #define LUNCHBOX_REQUESTHANDLER_H
22 #include <lunchbox/thread.h>
24 #include <servus/uint128_t.h>
28 namespace detail {
class RequestHandler; }
73 {
return _register( data ); }
101 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
void*& result,
105 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID, uint32_t& result,
108 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
bool& result,
111 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
112 servus::uint128_t& result,
115 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID );
124 {
return isRequestReady(
id ); }
142 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
145 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
148 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
bool result );
150 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
151 const servus::uint128_t& result );
158 LUNCHBOX_API
bool isRequestReady(
const uint32_t )
const;
161 detail::RequestHandler*
const _impl;
162 friend LUNCHBOX_API std::ostream& operator << ( std::ostream&,
163 const RequestHandler& );
164 LUNCHBOX_API uint32_t _register(
void* data );
165 LB_TS_VAR( _thread );
168 LUNCHBOX_API std::ostream&
operator << ( std::ostream&,
const RequestHandler& );
171 #include <lunchbox/request.h>
175 template<
class T >
inline
182 #endif //LUNCHBOX_REQUESTHANDLER_H
bool isRequestServed(const uint32_t id) const LB_DEPRECATED
Poll for the completion of a request.
Defines export visibility macros for Lunchbox.
Basic type definitions not provided by the operating system.
LUNCHBOX_API bool waitRequest(const uint32_t requestID, void *&result, const uint32_t timeout=LB_TIMEOUT_INDEFINITE)
Wait a given time for the completion of a request.
#define LB_TIMEOUT_INDEFINITE
Constant defining 'wait forever' in methods with wait parameters.
LUNCHBOX_API void serveRequest(const uint32_t requestID, void *result=0)
Serve a request with a void* result.
LUNCHBOX_API bool hasPendingRequests() const
A Future implementation for a RequestHandler request.
uint32_t registerRequest(void *data=0) LB_DEPRECATED
Register a request.
LUNCHBOX_API ~RequestHandler()
Destruct the request handler.
std::ostream & operator<<(std::ostream &os, const Array< T > &array)
Pretty-print all members of the array.
A thread-safe request handler.
Request< T > registerRequest(void *data=0)
Register a request.
LUNCHBOX_API void unregisterRequest(const uint32_t requestID)
Unregister a request.
LUNCHBOX_API RequestHandler()
Construct a new request handler.
LUNCHBOX_API void * getRequestData(const uint32_t requestID)
Retrieve the user-specific data for a request.