-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
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!
spiped/lib/dnsthread/dnsthread.c
Lines 107 to 120 in 5ce9cff
| 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,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels