[threads] Update mutex/cond functions to use new CHECK_ERR macros

Added various macros to check return values and log any errors and abort
if the call fails.
Updated logging to handle early errors before logging initialized.
This commit is contained in:
Scott Shambarger
2017-01-21 07:11:20 -08:00
parent b54d94fda6
commit 8e3797ec43
8 changed files with 207 additions and 185 deletions

View File

@@ -428,19 +428,19 @@ ffmpeg_lockmgr(void **pmutex, enum AVLockOp op)
*pmutex = malloc(sizeof(pthread_mutex_t));
if (!*pmutex)
return 1;
fork_mutex_init(*pmutex);
CHECK_ERR(L_MAIN, mutex_init(*pmutex));
return 0;
case AV_LOCK_OBTAIN:
fork_mutex_lock(*pmutex);
CHECK_ERR(L_MAIN, pthread_mutex_lock(*pmutex));
return 0;
case AV_LOCK_RELEASE:
fork_mutex_unlock(*pmutex);
CHECK_ERR(L_MAIN, pthread_mutex_unlock(*pmutex));
return 0;
case AV_LOCK_DESTROY:
fork_mutex_destroy(*pmutex);
CHECK_ERR(L_MAIN, pthread_mutex_destroy(*pmutex));
free(*pmutex);
*pmutex = NULL;
@@ -450,7 +450,6 @@ ffmpeg_lockmgr(void **pmutex, enum AVLockOp op)
return 1;
}
int
main(int argc, char **argv)
{