Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00013 #ifndef TASK_MANAGER_H
00014 #define TASK_MANAGER_H
00015
00016 #include <boost/function.hpp>
00017 #include <boost/thread.hpp>
00018 #include <systemc>
00019 #include "utils/io-lock.h"
00020 #include "sync-task.h"
00021
00025 class task_manager {
00026 public:
00027 static task_manager *get_instance();
00028 private:
00029 static task_manager *m_instance;
00030 task_manager() {};
00031 ~task_manager();
00032
00033 public:
00034 sync_task *get_current_task() const {return *m_current_task.get();}
00035 void alloc_current_task() {
00036 m_current_task.reset(new sync_task*());
00037 }
00038
00039 void set_current_task(sync_task *r) {
00040 assert(m_current_task.get() != NULL);
00041 *m_current_task.get() = r;
00042 }
00043 private:
00044 boost::thread_specific_ptr<sync_task*> m_current_task;
00045 };
00046
00047 #endif // TASK_MANAGER_H