3 * Copyright 2007 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_MB_RUNTIME_THREAD_PER_BLOCK_H
22 #define INCLUDED_MB_RUNTIME_THREAD_PER_BLOCK_H
24 #include <mb_runtime_base.h>
25 #include <mb_worker.h>
26 #include <mblock/msg_queue.h>
27 #include <mb_timer_queue.h>
30 * \brief Concrete runtime that uses a thread per mblock
33 * These are all implementation details.
35 class mb_runtime_thread_per_block : public mb_runtime_base
38 omni_mutex d_workers_mutex; // hold while manipulating d_workers
39 std::vector<mb_worker*> d_workers;
40 bool d_shutdown_in_progress;
41 pmt_t d_shutdown_result;
43 mb_timer_queue d_timer_queue;
45 typedef std::vector<mb_worker*>::iterator worker_iter_t;
47 mb_runtime_thread_per_block();
48 ~mb_runtime_thread_per_block();
50 bool run(const std::string &instance_name,
51 const std::string &class_name,
55 void request_shutdown(pmt_t result);
59 create_component(const std::string &instance_name,
60 const std::string &class_name,
64 schedule_one_shot_timeout(const mb_time &abs_time, pmt_t user_data,
65 mb_msg_accepter_sptr accepter);
68 schedule_periodic_timeout(const mb_time &first_abs_time,
69 const mb_time &delta_time,
71 mb_msg_accepter_sptr accepter);
73 cancel_timeout(pmt_t handle);
76 void reap_dead_workers();
79 void send_all_sys_msg(pmt_t signal, pmt_t data = PMT_F,
80 pmt_t metadata = PMT_F,
81 mb_pri_t priority = MB_PRI_BEST);
84 #endif /* INCLUDED_MB_RUNTIME_THREAD_PER_BLOCK_H */