1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19
20/*****************************************************************************
21
22  Original Author: Bishnupriya Bhattacharya, Cadence Design Systems,
23                   September 5, 2003
24
25 *****************************************************************************/
26
27// test error message for wait() on dynamic method process handle's event.
28
29/*****************************************************************************
30
31  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
32  changes you are making here.
33
34      Name, Affiliation, Date: Andy Goodrich, Forte Design Systems, 26 Jul 2005
35  Description of Modification: Changed waits to use the new terminated_event
36                               support.
37
38 *****************************************************************************/
39// $Log: test03.cpp,v $
40// Revision 1.2  2011/02/01 17:17:40  acg
41//  Andy Goodrich: update of copyright notice, added visible CVS logging.
42//
43
44#define SC_INCLUDE_DYNAMIC_PROCESSES
45#include <systemc.h>
46
47int function_method(double d)
48{
49  cout << endl << sc_time_stamp() << ", "
50       << sc_get_current_process_handle().name()
51       << ": function_method sees " << d << endl;
52  return int(d);
53}
54
55class module1 : public sc_module
56{
57private:
58  sc_event& ev;
59public:
60
61  SC_HAS_PROCESS(module1);
62
63  module1(sc_module_name name, sc_event& event) : sc_module(name),
64    ev(event)
65  {
66    SC_METHOD(static_method);
67  }
68
69  void static_method() {
70    int r;
71    cout << endl << sc_time_stamp() << ": static_method, Before spawning function_method " << endl;
72    sc_spawn_options o1;
73    o1.spawn_method();
74    o1.dont_initialize();
75    o1.set_sensitivity(&ev);
76    sc_process_handle h4 = sc_spawn(&r, sc_bind(&function_method, 1.2345), "event_sensitive_method", &o1);
77    wait(h4.terminated_event());
78  }
79};
80
81int sc_main (int argc , char *argv[])
82{
83  sc_event event1;
84  event1.notify(55, SC_NS);
85
86  module1 mod1("mod1", event1);
87  sc_start(100, SC_NS);
88  return 0;
89}
90