MCPcopy Create free account
hub / github.com/F-Stack/f-stack / fdset_del

Function fdset_del

dpdk/lib/vhost/fd_man.c:146–171  ·  view source on GitHub ↗

* Unregister the fd from the fdset. * Returns context of a given fd or NULL. */

Source from the content-addressed store, hash-verified

144 * Returns context of a given fd or NULL.
145 */
146void *
147fdset_del(struct fdset *pfdset, int fd)
148{
149 int i;
150 void *dat = NULL;
151
152 if (pfdset == NULL || fd == -1)
153 return NULL;
154
155 do {
156 pthread_mutex_lock(&pfdset->fd_mutex);
157
158 i = fdset_find_fd(pfdset, fd);
159 if (i != -1 && pfdset->fd[i].busy == 0) {
160 /* busy indicates r/wcb is executing! */
161 dat = pfdset->fd[i].dat;
162 pfdset->fd[i].fd = -1;
163 pfdset->fd[i].rcb = pfdset->fd[i].wcb = NULL;
164 pfdset->fd[i].dat = NULL;
165 i = -1;
166 }
167 pthread_mutex_unlock(&pfdset->fd_mutex);
168 } while (i != -1);
169
170 return dat;
171}
172
173/**
174 * Unregister the fd from the fdset.

Callers 3

fdset_pipe_uninitFunction · 0.85
vduse_vring_cleanupFunction · 0.85
vduse_device_destroyFunction · 0.85

Calls 3

pthread_mutex_lockFunction · 0.85
fdset_find_fdFunction · 0.85
pthread_mutex_unlockFunction · 0.85

Tested by

no test coverage detected