• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List

request_queue_impl_worker.h

00001 /***************************************************************************
00002  *  include/stxxl/bits/io/request_queue_impl_worker.h
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de>
00007  *  Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
00008  *
00009  *  Distributed under the Boost Software License, Version 1.0.
00010  *  (See accompanying file LICENSE_1_0.txt or copy at
00011  *  http://www.boost.org/LICENSE_1_0.txt)
00012  **************************************************************************/
00013 
00014 #ifndef STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
00015 #define STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
00016 
00017 #ifdef STXXL_BOOST_CONFIG
00018  #include <boost/config.hpp>
00019 #endif
00020 
00021 #ifdef STXXL_BOOST_THREADS // Use Portable Boost threads
00022  #include <boost/thread/thread.hpp>
00023 #else
00024  #include <pthread.h>
00025 #endif
00026 
00027 #include <stxxl/bits/io/request_queue.h>
00028 #include <stxxl/bits/common/semaphore.h>
00029 #include <stxxl/bits/common/state.h>
00030 
00031 
00032 __STXXL_BEGIN_NAMESPACE
00033 
00036 
00037 class request_queue_impl_worker : public request_queue
00038 {
00039 protected:
00040     enum thread_state { NOT_RUNNING, RUNNING, TERMINATING, TERMINATE = TERMINATING };
00041 
00042 #ifdef STXXL_BOOST_THREADS
00043     typedef boost::thread * thread_type;
00044 #else
00045     typedef pthread_t thread_type;
00046 #endif
00047 
00048 protected:
00049     void start_thread(void * (*worker)(void *), void * arg, thread_type & t, state<thread_state> & s);
00050     void stop_thread(thread_type & t, state<thread_state> & s, semaphore & sem);
00051 };
00052 
00054 
00055 __STXXL_END_NAMESPACE
00056 
00057 #endif // !STXXL_IO_REQUEST_QUEUE_IMPL_WORKER_HEADER
00058 // vim: et:ts=4:sw=4

Generated on Sun Oct 17 2010 06:13:44 for Stxxl by  doxygen 1.7.1