Ejemplo n.º 1
0
void register_sleep_event(thread_t *me, event_t *e)
{
	sched_lock();
	thread_t *t;
	Q_SEARCH(t, &state.sleep_queue, q_link,
	         time_lt(e->u.wakeup, t->sleep_event.u.wakeup));
	if (t) {
		Q_INSERT_BEFORE(&state.sleep_queue, t, me, q_link);
	} else {
		Q_INSERT_TAIL(&state.sleep_queue, me, q_link);
	}
	sched_unlock();
}
Ejemplo n.º 2
0
/* register a malloced chunk as belonging to a particular mutex.
 * will add mutex to the list of all mutexes if it's not already there. */
void learn_malloced_mutex_structure(struct user_sync_state *u, unsigned int lock_addr,
				    unsigned int chunk_addr, unsigned int chunk_size)
{
	struct mutex *mp;
	assert(lock_addr != -1);
	Q_SEARCH(mp, &u->mutexes, nobe, mp->addr == (unsigned int)lock_addr);
	if (mp == NULL) {
		lsprintf(DEV, "created user mutex 0x%x (%u others)\n",
			 lock_addr, Q_GET_SIZE(&u->mutexes));
		mp = MM_XMALLOC(1, struct mutex);
		mp->addr = (unsigned int)lock_addr;
		Q_INIT_HEAD(&mp->chunks);
		Q_INSERT_FRONT(&u->mutexes, mp, nobe);
	}
Ejemplo n.º 3
0
struct agent *agent_by_tid_or_null(struct agent_q *q, int tid)
{
	struct agent *a;
	Q_SEARCH(a, q, nobe, a->tid == tid);
	return a;
}