_gcry_ath_mutex_lock: Assertion `*lock == ((ath_mutex_t) 0)' failed.
如果你的多執行緒程式出現如題的錯誤,然後直接 Aborted (core dumped) 掉,那麼一定是由於你所使用的gnutls介面沒有進行鎖的初始化,
在程式初始化時加入以下程式碼即可:
#include <gnutls/gnutls.h>
static int mutex_init(void **mutex)
{
*mutex = malloc(sizeof(pthread_mutex_t));
pthread_mutex_init(*mutex, NULL);
return 0;
}
static int mutex_lock(void **mutex)
{
pthread_mutex_lock(*mutex);
return 0;
}
static int mutex_unlock(void **mutex)
{
pthread_mutex_unlock(*mutex);
return 0;
}
static int mutex_deinit(void **mutex)
{
pthread_mutex_destroy(*mutex);
free(*mutex);
return 0;
}
int main(int argc, char **argv)
{
gnutls_global_set_mutex(mutex_init, mutex_deinit,
mutex_lock, mutex_unlock);
gnutls_global_init();
// your codes
return 0;
}
相關文章
- Assertion failure 錯誤AI
- vulnhub - ASSERTION1.0.1
- tensorflow.python.framework.errors_impl.InvalidArgumentError: assertion failed: [0] [Op:Assert] namePythonFrameworkErrorAI
- Android:Unexpected lock protocol found in lock file. Expected 3, found 0.AndroidProtocol
- Assertion failure in -[UICollectionViewData validateLayoutInRect:]AIUIView
- 問題解決:shared_ptr Assertion px != 0 failed 及debug經驗分享AI
- [VRDevice] Initialization of device oculus failed.VRdevAI
- ORA-29516: Aurora assertion failure: Assertion failure at joez.c:3311AI
- [InnoDB] Assertion failure: ut0ut.cc:553 thread 140235111884544【筆記】AIthread筆記
- Assertion failure in -[UITableView -configureCellForDisplay:forIndexPath:]AIUIViewIndex
- SCP報錯:Host key verification failed.AI
- 轉:Assertion failure in -[UITableView _configureCellForDisplay:forIndexPath:]AIUIViewIndex
- ASSERTION FAILED: TLS ALLOCATOR ALLOC_TEMP_THREAD...AITLSthread
- MongoDB報錯:"assertion" : "can't map file memory"MongoDB
- cannot convert (type interface {}) to type int: need type assertion
- 安裝CLUSTER碰到 Assertion failed offset fFileSize錯誤AI
- Load of cache file failed. rc=1301AI
- Python中不盡如人意的斷言AssertionPython
- oracle lock鎖_v$lock_轉Oracle
- spin_lock、spin_lock_irq、spin_lock_irqsave區別【轉】
- javascript:void(null)gitLab---Host key verification failed.JavaScriptNullGitlabAI
- mysql innodb lock鎖之record lock之一MySql
- CRS-4124: Oracle High Availability Services startup failed.OracleAI
- 【MySQL】select for update 的Row Lock 與Table LockMySql
- mysql lock操作MySql
- [Oracle Script] LockOracle
- JAVA_LockJava
- TM LOCK MODE
- About Oracle LockOracle
- oracle enqueue lockOracleENQ
- Oracle Latch & LockOracle
- JAR creation failed. See details for additional information解決方案大全JARAIORM
- 0403-030 The fork function failed. Too many processes already existFunctionAI
- 遭遇 bug InnoDB: Failing assertion: page_get_n_recs(page) > 1AI
- Mac SSH 連線出現 Host key verification failed. 錯誤解決MacAI
- EBS: collect2: ld returned 1 exit status, Relink of module "FEMCCE" failed.AI
- MySQL:理解MDL LockMySql
- Java™ 教程(Lock物件)Java物件