SystemC
Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
|
A list of channel locks acquired by a process. More...
#include <sysc/kernel/sc_process.h>
Public Member Functions | |
void | lock_and_push (CHNL_MTX_TYPE_ *lock) |
Acquire a new channel lock or increment the lock counter. More... | |
void | pop_and_unlock (CHNL_MTX_TYPE_ *lock) |
Release a channel lock or decrement the lock counter. More... | |
void | lock_all (void) |
Acquire all the channel locks in the list. More... | |
void | unlock_all (void) |
Release all the channel locks in the list. More... | |
A list of channel locks acquired by a process.
This class implements the object to maintain a list of channel locks acquired in the hierachical channels. The outer channel lock is at the beginning of the list, and the inner channel lock is at the end of the list. The order of the acquired channel locks is maintained as LIFO (Last-In-First-Out), meaning that the outer channel lock is acquired first and released last.
Notes: (1) In the lock_and_push method, it will first check whether the new channel lock is the same as the last one in the list. If they are the same (one method calls another in the current-level channel), it will only increment the lock counter; if the new channel lock is not in the list, then it will be locked and pushed into the end of the list; if the new lock is in the list but not the last one (an inner channel method calls an outer channel method), assertion fails and it stops the simulation. (2) In the pop_and_unlock method, it will always try to unlock the last channel lock in the list, otherwise it breaks the correct order to unlock locks (may lead to deadlock issues). When the counter of the last lock is larger than one, it will decrement the counter. If the counter equals one, it pops the lock from the list and releases the lock. (3) In lock_all and unlock_all methods, it will acquire all the locks from the beginning to the end, and release all the locks in the reverse order.
Definition at line 375 of file sc_process.h.
void sc_core::sc_acq_chnl_lock_queue::lock_all | ( | void | ) |
Acquire all the channel locks in the list.
Acquire all the locks from the beginning to the end.
void sc_core::sc_acq_chnl_lock_queue::lock_and_push | ( | CHNL_MTX_TYPE_ * | lock | ) |
Acquire a new channel lock or increment the lock counter.
In the lock_and_push method, it will first check whether the new channel lock is the same as the last one in the list. If they are the same (one method calls another in the current-level channel), it will only increment the lock counter; if the new channel lock is not in the list, then it will be locked and pushed into the end of the list; if the new lock is in the list but not the last one (an inner channel method calls an outer channel method), assertion fails and it stops the simulation.
void sc_core::sc_acq_chnl_lock_queue::pop_and_unlock | ( | CHNL_MTX_TYPE_ * | lock | ) |
Release a channel lock or decrement the lock counter.
In the pop_and_unlock method, it will always try to unlock the last channel lock in the list, otherwise it breaks the correct order to unlock locks (may lead to deadlock issues). When the counter of the last lock is larger than one, it will decrement the counter. If the counter equals one, it pops the lock from the list and releases the lock.
void sc_core::sc_acq_chnl_lock_queue::unlock_all | ( | void | ) |
Release all the channel locks in the list.
Release all the locks from the end to the beginning.