3 * Copyright 2007,2010 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #ifndef INCLUDED_GC_CLIENT_THREAD_INFO_H
22 #define INCLUDED_GC_CLIENT_THREAD_INFO_H
24 #include <boost/thread.hpp>
25 #include <boost/utility.hpp>
34 * \brief per client-thread data used by gc_job_manager
36 * "Client threads" are any threads that invoke methods on
37 * gc_job_manager. We use pthread_set_specific to store a pointer to
38 * one of these for each thread that comes our way.
40 class gc_client_thread_info : boost::noncopyable {
42 gc_client_thread_info() :
43 d_free(1), d_cond(), d_state(CT_NOT_WAITING),
44 d_jobs_done(0), d_njobs_waiting_for(0),
45 d_jobs_waiting_for(0){ }
47 ~gc_client_thread_info() {
49 d_state = CT_NOT_WAITING;
51 d_njobs_waiting_for = 0;
52 d_jobs_waiting_for = 0;
55 //! is this cti free? (1->free, 0->in use)
58 //! which client info are we?
61 //! hold this mutex to manipulate anything below here
64 //! signaled by event handler to wake client thread up
65 boost::condition_variable d_cond;
67 //! Is this client waiting?
70 //! Jobs that have finished and not yet been waited for (bitvector)
71 unsigned long *d_jobs_done;
73 //! # of jobs we're waiting for
74 unsigned int d_njobs_waiting_for;
76 //! Jobs that client thread is waiting for
77 gc_job_desc **d_jobs_waiting_for;
81 #endif /* INCLUDED_GC_CLIENT_THREAD_INFO_H */