Go to the documentation of this file.
32 :
addr(addr_in), tgid(tgid_in) {}
44 for (
int i = 0;
i <
sizeof(uint64_t) /
sizeof(
size_t);
i++) {
45 hash ^= (size_t)(in.
addr >>
sizeof(
size_t) *
i) ^
46 (
size_t)(in.
tgid >>
sizeof(size_t) *
i);
53 : tc(_tc), bitmask(_bitmask) { }
58 return bitmask & wakeup_bitmask;
77 auto &waiterList = it->second;
79 while (!waiterList.empty() && woken_up <
count) {
84 auto& tc = waiterList.front().tc;
87 waiterList.pop_front();
91 if (waiterList.empty())
106 insert({key, waiterList});
127 auto &waiterList = it->second;
128 auto iter = waiterList.begin();
130 while (iter != waiterList.end()) {
135 iter = waiterList.erase(iter);
143 if (waiterList.empty())
153 auto it1 = find(key1);
159 auto &waiterList1 =
it1->second;
161 while (!waiterList1.empty() && woken_up <
count) {
162 waiterList1.front().tc->activate();
163 waiterList1.pop_front();
170 while (!waiterList1.empty() && requeued < count2) {
171 auto w = waiterList1.front();
172 waiterList1.pop_front();
173 tmpList.push_back(
w);
178 auto it2 = find(key2);
180 if (
it2 == end() && requeued > 0) {
181 insert({key2, tmpList});
183 it2->second.insert(
it2->second.end(),
184 tmpList.begin(), tmpList.end());
187 if (waiterList1.empty())
190 return woken_up + requeued;
void suspend(Addr addr, uint64_t tgid, ThreadContext *tc)
Inserts a futex into the map with one waiting TC.
int wakeup(Addr addr, uint64_t tgid, int count)
Wakes up at most count waiting threads on a futex.
std::unordered_set< ThreadContext * > waitingTcs
virtual void activate()=0
Set the status to Active.
bool operator==(const FutexKey &in) const
void suspend_bitset(Addr addr, uint64_t tgid, ThreadContext *tc, int bitmask)
virtual void suspend()=0
Set the status to Suspended.
bool checkMask(int wakeup_bitmask) const
return true if the bit-wise AND of the wakeup_bitmask given by a waking thread and this thread's inte...
bool is_waiting(ThreadContext *tc)
Determine if the given thread context is currently waiting on a futex wait operation on any of the fu...
FutexKey class defines an unique identifier for a particular futex in the system.
ThreadContext is the external interface to all thread state for anything outside of the CPU.
size_t operator()(const FutexKey &in) const
WaiterState(ThreadContext *_tc, int _bitmask)
this constructor is used if futex ops with bitset are used
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
FutexKey(uint64_t addr_in, uint64_t tgid_in)
int requeue(Addr addr1, uint64_t tgid, int count, int count2, Addr addr2)
This operation wakes a given number (val) of waiters.
WaiterState defines internal state of a waiter thread.
Overload hash function for BasicBlockRange type.
int wakeup_bitset(Addr addr, uint64_t tgid, int bitmask)
Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17