24 #if STXXL_STD_THREADS && STXXL_MSVC >= 1700
28 #ifndef STXXL_CHECK_FOR_PENDING_REQUESTS_ON_SUBMISSION
29 #define STXXL_CHECK_FOR_PENDING_REQUESTS_ON_SUBMISSION 1
34 struct file_offset_match :
public std::binary_function<request_ptr, request_ptr, bool>
41 return (a->get_offset() == b->get_offset()) &&
42 (a->get_file() == b->get_file());
46 request_queue_impl_1q::request_queue_impl_1q(
int n)
47 : m_thread_state(NOT_RUNNING), m_sem(0)
59 if (!dynamic_cast<serving_request*>(req.
get()))
60 STXXL_ERRMSG(
"Incompatible request submitted to running queue.");
62 #if STXXL_CHECK_FOR_PENDING_REQUESTS_ON_SUBMISSION
69 STXXL_ERRMSG(
"request submitted for a BID with a pending request");
85 if (!dynamic_cast<serving_request*>(req.
get()))
86 STXXL_ERRMSG(
"Incompatible request submitted to running queue.");
88 bool was_still_in_queue =
false;
91 queue_type::iterator pos
98 was_still_in_queue =
true;
103 return was_still_in_queue;
113 self* pthis =
static_cast<self*
>(arg);
121 if (!pthis->m_queue.empty())
124 pthis->m_queue.pop_front();
141 if ((pthis->m_sem--) == 0)
150 #if STXXL_STD_THREADS && STXXL_MSVC >= 1700
static void * worker(void *arg)
Implementation of a local request queue having only one queue for both read and write requests...
void unlock()
unlock mutex hold prematurely
Type * get() const
return the enclosed pointer.
void add_request(request_ptr &req)
bool empty() const
test for a NULL pointer
#define STXXL_THROW_INVALID_ARGUMENT(error_message)
Throws std::invalid_argument with "Error in [function] : [error_message]".
void stop_thread(thread_type &t, state< thread_state > &s, semaphore &sem)
Request which serves an I/O by calling the synchronous routine of the file.
counting_ptr< request > request_ptr
A reference counting pointer for request.
Aquire a lock that's valid until the end of scope.
#define STXXL_BEGIN_NAMESPACE
void STXXL_UNUSED(const U &)
state< thread_state > m_thread_state
void start_thread(void *(*worker)(void *), void *arg, thread_type &t, state< thread_state > &s)
#define _STXXL_FORCE_SEQUENTIAL
bool cancel_request(request_ptr &req)
ExtIterator find(ExtIterator begin, ExtIterator end, const EqualityComparable &value, int_type nbuffers=0)
External equivalent of std::find, see stxxl::find.
#define STXXL_END_NAMESPACE