+/**
+ * Increment action counter for thread tid
+ * @return true if the counter for tid expires
+ */
+bool WaitObj::incr_counter(thread_id_t tid)
+{
+ int thread_id = id_to_int(tid);
+
+ /* thrd_action_counters.resize does not work here */
+ while (thrd_action_counters.size() <= (uint) thread_id) {
+ thrd_action_counters.push_back(0);
+ }
+
+ thrd_action_counters[thread_id]++;
+ if (thrd_action_counters[thread_id] > COUNTER_THRESHOLD) {
+ thrd_action_counters[thread_id] = 0;
+ return true;
+ }
+
+ return false;
+}
+