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; }
98 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
void*& result,
102 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID, uint32_t& result,
105 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
bool& result,
108 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID,
109 servus::uint128_t& result,
112 LUNCHBOX_API
bool waitRequest(
const uint32_t requestID );
121 {
return isRequestReady(
id ); }
139 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
142 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
145 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
bool result );
147 LUNCHBOX_API
void serveRequest(
const uint32_t requestID,
148 const servus::uint128_t& result );
155 LUNCHBOX_API
bool isRequestReady(
const uint32_t )
const;
158 detail::RequestHandler*
const _impl;
159 friend LUNCHBOX_API std::ostream& operator << ( std::ostream&,
160 const RequestHandler& );
161 LUNCHBOX_API uint32_t _register(
void* data );
162 LB_TS_VAR( _thread );
165 LUNCHBOX_API std::ostream&
operator << ( std::ostream&,
const RequestHandler& );
168 #include <lunchbox/request.h>
172 template<
class T >
inline
179 #endif //LUNCHBOX_REQUESTHANDLER_H
bool isRequestServed(const uint32_t id) const LB_DEPRECATED
Poll for the completion of a request.
~RequestHandler()
Destruct the request handler.
Defines export visibility macros for library Lunchbox.
Basic type definitions not provided by the operating system.
void unregisterRequest(const uint32_t requestID)
Unregister a request.
uint32_t registerRequest(void *data=0)
Register a request.
#define LB_TIMEOUT_INDEFINITE
Constant defining 'wait forever' in methods with wait parameters.
RequestHandler()
Construct a new request handler.
bool hasPendingRequests() const
void * getRequestData(const uint32_t requestID)
Retrieve the user-specific data for a request.
A Future implementation for a RequestHandler request.
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.
void serveRequest(const uint32_t requestID, void *result=0)
Serve a request with a void* result.
Abstraction layer and common utilities for multi-threaded programming.
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.