-
Notifications
You must be signed in to change notification settings - Fork 3.3k
A possible locking issue #885
Copy link
Copy link
Closed
Labels
Description
Hi, should the lock be released after Line 863 to protect l->dropped++ from races?
Lines 858 to 865 in 894e4c1
| pthread_mutex_lock(&l->mutex); | |
| /* Request a maximum length of data to write to */ | |
| e = (logentry *) bipbuf_request(buf, (sizeof(logentry) + reqlen)); | |
| if (e == NULL) { | |
| pthread_mutex_unlock(&l->mutex); | |
| l->dropped++; | |
| return LOGGER_RET_NOSPACE; | |
| } |
like this way
pthread_mutex_lock(&l->mutex);
/* Request a maximum length of data to write to */
e = (logentry *) bipbuf_request(buf, (sizeof(logentry) + reqlen));
if (e == NULL) {
l->dropped++;
pthread_mutex_unlock(&l->mutex);
return LOGGER_RET_NOSPACE;
}
Reactions are currently unavailable