isc__nm_in_netthread

This commit is contained in:
Witold Kręcicki
2019-09-10 17:06:46 +02:00
committed by Ondřej Surý
parent 8461e06eb4
commit 2ae0f9d00a
4 changed files with 15 additions and 1 deletions
+1
View File
@@ -47,6 +47,7 @@ isc_nm_attach(isc_nm_t *mgr, isc_nm_t **dst);
void
isc_nm_detach(isc_nm_t **mgr0);
/*
* isc_nm_freehandle frees a handle, releasing resources
*/
+4
View File
@@ -294,6 +294,10 @@ struct isc_nmsocket {
int
isc__nm_tid(void);
/* Are we in network thread? */
bool
isc__nm_in_netthread(void);
void
isc__nmhandle_free(isc_nmsocket_t *socket, isc_nmhandle_t *handle);
+5
View File
@@ -68,6 +68,11 @@ isc__nm_tid() {
return (isc__nm_tid_v);
}
bool
isc__nm_in_netthread() {
return (isc__nm_tid_v >= 0);
}
/*
* isc_nm_start creates and starts a network manager, with `workers` workers.
*/
+5 -1
View File
@@ -117,7 +117,7 @@ isc_nm_udp_stoplistening(isc_nmsocket_t *socket) {
INSIST(VALID_NMSOCK(socket));
/* We can't be launched from network thread */
INSIST(isc__nm_tid() == ISC_NETMGR_TID_UNKNOWN);
REQUIRE(!isc__nm_in_netthread());
INSIST(socket->type == isc_nm_udplistener);
for (i = 0; i < socket->nchildren; i++) {
@@ -128,6 +128,10 @@ isc_nm_udp_stoplistening(isc_nmsocket_t *socket) {
isc__nm_enqueue_ievent(&socket->mgr->workers[i],
(isc__netievent_t*) ievent);
}
/*
* XXXWPK TODO wait for everything to clean up, we have a race here
* clients think that we stopped listening and we still might issue callbacks
*/
}
/*