Exemplo n.º 1
0
static inline void
evt_put(long evtid)
{
	if (ncached >= EVT_CACHE_SZ) evt_free(cos_spd_id(), evtid);
	else                         evt_cache[ncached++] = evtid;
	cvect_del(&evts, evtid);
}
bool bt_hci_unregister(struct bt_hci *hci, unsigned int id)
{
	struct evt *evt;

	if (!hci || !id)
		return false;

	evt = queue_remove_if(hci->evt_list, match_evt_id, UINT_TO_PTR(id));
	if (!evt)
		return false;

	evt_free(evt);

	return true;
}
Exemplo n.º 3
0
static void 
accept_new(int accept_fd)
{
	int eid;

	eid = evt_get();
	assert(eid > 0);
	pid_torrent = from_tsplit(cos_spd_id(), accept_fd, "", 0, TOR_RW, eid);
	assert(pid_torrent!= accept_fd);
	
	printc("accept_new: eid %d pid_torrent %d (accept_fd %d)\n", 
	       eid, pid_torrent, accept_fd);
	
	if (-EAGAIN == pid_torrent) {
		evt_free(cos_spd_id(), eid);
		return;
	} else if (pid_torrent < 0) {
		printc("pwrite to id_torrent %d\n", pid_torrent);
		BUG();
		return;
	}
	
	mapping_add(pid_torrent, 0, eid, 0);
}