SystemC
3.0.0
Accellera SystemC proof-of-concept library
sysc
communication
sc_mutex.h
Go to the documentation of this file.
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
sc_mutex.h -- The sc_mutex primitive channel class.
23
24
Original Author: Martin Janssen, Synopsys, Inc., 2001-05-21
25
26
CHANGE LOG IS AT THE END OF THE FILE
27
*****************************************************************************/
28
29
#ifndef SC_MUTEX_H
30
#define SC_MUTEX_H
31
32
#include "
sysc/kernel/sc_event.h
"
33
#include "
sysc/kernel/sc_object.h
"
34
#include "
sysc/kernel/sc_wait.h
"
35
#include "
sysc/communication/sc_mutex_if.h
"
36
37
namespace
sc_core
{
38
39
// ----------------------------------------------------------------------------
40
// CLASS : sc_mutex
41
//
42
// The sc_mutex primitive channel class.
43
// ----------------------------------------------------------------------------
44
45
class
SC_API
sc_mutex
46
:
public
sc_mutex_if
,
47
public
sc_object
48
{
49
public
:
50
51
// constructors and destructor
52
53
sc_mutex
();
54
explicit
sc_mutex
(
const
char
* name_ );
55
virtual
~sc_mutex
();
56
57
58
// interface methods
59
60
// blocks until mutex could be locked
61
virtual
int
lock
();
62
63
// returns -1 if mutex could not be locked
64
virtual
int
trylock
();
65
66
// returns -1 if mutex was not locked by caller
67
virtual
int
unlock
();
68
69
virtual
const
char
*
kind
()
const
70
{
return
"sc_mutex"
; }
71
72
protected
:
73
74
// support methods
75
76
bool
in_use
()
const
77
{
return
( m_owner != 0 ); }
78
79
protected
:
80
81
sc_process_b
*
m_owner
;
82
sc_event
m_free
;
83
84
private
:
85
86
// disabled
87
sc_mutex
(
const
sc_mutex
& );
88
sc_mutex
& operator = (
const
sc_mutex
& );
89
};
90
91
}
// namespace sc_core
92
93
//$Log: sc_mutex.h,v $
94
//Revision 1.4 2011/08/26 20:45:41 acg
95
// Andy Goodrich: moved the modification log to the end of the file to
96
// eliminate source line number skew when check-ins are done.
97
//
98
//Revision 1.3 2011/02/18 20:23:45 acg
99
// Andy Goodrich: Copyright update.
100
//
101
//Revision 1.2 2010/11/02 16:31:01 acg
102
// Andy Goodrich: changed object derivation to use sc_object rather than
103
// sc_prim_channel as the parent class.
104
//
105
//Revision 1.1.1.1 2006/12/15 20:20:04 acg
106
//SystemC 2.3
107
//
108
//Revision 1.2 2006/01/03 23:18:26 acg
109
//Changed copyright to include 2006.
110
//
111
//Revision 1.1.1.1 2005/12/19 23:16:43 acg
112
//First check in of SystemC 2.1 into its own archive.
113
//
114
//Revision 1.10 2005/09/15 23:01:51 acg
115
//Added std:: prefix to appropriate methods and types to get around
116
//issues with the Edison Front End.
117
//
118
//Revision 1.9 2005/06/10 22:43:55 acg
119
//Added CVS change log annotation.
120
//
121
122
#endif
123
124
// Taf!
sc_object.h
SC_API
#define SC_API
Definition:
sc_cmnhdr.h:148
sc_wait.h
sc_event.h
sc_mutex_if.h
sc_core
Definition:
sc_buffer.h:36
sc_core::sc_mutex
Definition:
sc_mutex.h:48
sc_core::sc_mutex::sc_mutex
sc_mutex(const char *name_)
sc_core::sc_mutex::kind
virtual const char * kind() const
Definition:
sc_mutex.h:69
sc_core::sc_mutex::lock
virtual int lock()
sc_core::sc_mutex::sc_mutex
sc_mutex()
sc_core::sc_mutex::m_free
sc_event m_free
Definition:
sc_mutex.h:82
sc_core::sc_mutex::~sc_mutex
virtual ~sc_mutex()
sc_core::sc_mutex::unlock
virtual int unlock()
sc_core::sc_mutex::trylock
virtual int trylock()
sc_core::sc_mutex::in_use
bool in_use() const
Definition:
sc_mutex.h:76
sc_core::sc_mutex::m_owner
sc_process_b * m_owner
Definition:
sc_mutex.h:81
sc_core::sc_mutex_if
Definition:
sc_mutex_if.h:44
sc_core::sc_event
Definition:
sc_event.h:257
sc_core::sc_object
Definition:
sc_object.h:107
sc_core::sc_process_b
Definition:
sc_process.h:205
Generated on Fri Aug 16 2024 16:36:33 for SystemC by
1.9.4