Hi developers, in the below codes, the lock &T->mtx could be not released before program's exit exit(1); when noeintr_write(T->wakeupsock[0], &zero, 1) != 1 . I think there is no harm to write pthread_mutex_unlock(&T->mtx) before the exit(1); for better resource management and code symmetry. Thanks!
|
if ((rc = pthread_mutex_lock(&T->mtx)) != 0) { |
|
warn0("pthread_mutex_lock: %s", strerror(rc)); |
|
exit(1); |
|
} |
|
|
|
/* Write the answer back. */ |
|
T->sas = sas; |
|
T->res_errno = res_errno; |
|
|
|
/* Send a completion message. */ |
|
if (noeintr_write(T->wakeupsock[0], &zero, 1) != 1) { |
|
warnp("Error writing to wakeup socket"); |
|
exit(1); |
|
} |
Best,
Hi developers, in the below codes, the lock
&T->mtxcould be not released before program's exitexit(1);whennoeintr_write(T->wakeupsock[0], &zero, 1) != 1. I think there is no harm to writepthread_mutex_unlock(&T->mtx)before theexit(1);for better resource management and code symmetry. Thanks!spiped/lib/dnsthread/dnsthread.c
Lines 107 to 120 in 5ce9cff
Best,