process_types.hh (12961:9bd3a469fd11) process_types.hh (12998:68d2c7538b82)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 26 unchanged lines hidden (view full) ---

35
36namespace sc_gem5
37{
38
39class Method : public Process
40{
41 public:
42 Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 26 unchanged lines hidden (view full) ---

35
36namespace sc_gem5
37{
38
39class Method : public Process
40{
41 public:
42 Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
43 Process(name, func, _dynamic, true)
43 Process(name, func, _dynamic)
44 {}
45
46 const char *kind() const override { return "sc_method_process"; }
47
48 sc_core::sc_curr_proc_kind
49 procKind() const override
50 {
51 return sc_core::SC_METHOD_PROC_;
52 }
53};
54
55class Thread : public Process
56{
57 public:
58 Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
44 {}
45
46 const char *kind() const override { return "sc_method_process"; }
47
48 sc_core::sc_curr_proc_kind
49 procKind() const override
50 {
51 return sc_core::SC_METHOD_PROC_;
52 }
53};
54
55class Thread : public Process
56{
57 public:
58 Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :
59 Process(name, func, _dynamic, false), ctx(nullptr)
59 Process(name, func, _dynamic), ctx(nullptr)
60 {}
61
62 ~Thread() { delete ctx; }
63
64 const char *kind() const override { return "sc_thread_process"; }
65
66 void throw_it(ExceptionWrapperBase &exc, bool inc_kids) override;
67

--- 15 unchanged lines hidden (view full) ---

83 class Context : public Fiber
84 {
85 public:
86 Context(Thread *thread, size_t size) : Fiber(size), thread(thread) {}
87
88 private:
89 Thread *thread;
90
60 {}
61
62 ~Thread() { delete ctx; }
63
64 const char *kind() const override { return "sc_thread_process"; }
65
66 void throw_it(ExceptionWrapperBase &exc, bool inc_kids) override;
67

--- 15 unchanged lines hidden (view full) ---

83 class Context : public Fiber
84 {
85 public:
86 Context(Thread *thread, size_t size) : Fiber(size), thread(thread) {}
87
88 private:
89 Thread *thread;
90
91 void main() override { thread->run(); }
91 void
92 main() override
93 {
94 thread->_needsStart = false;
95 thread->run();
96 thread->terminate();
97 }
92 };
98 };
99 friend class Context;
93
94 Context *ctx;
95};
96
97class CThread : public Thread
98{
99 public:
100 CThread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :

--- 18 unchanged lines hidden ---
100
101 Context *ctx;
102};
103
104class CThread : public Thread
105{
106 public:
107 CThread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) :

--- 18 unchanged lines hidden ---