MCPcopy Create free account
hub / github.com/acl-dev/acl / init_log_mutex

Function init_log_mutex

lib_acl/src/stdlib/acl_mylog.c:140–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static void init_log_mutex(acl_pthread_mutex_t *lock)
141{
142#ifdef ACL_UNIX
143 int n1, n2;
144 pthread_mutexattr_t attr;
145
146 assert(lock);
147
148 n1 = pthread_mutexattr_init(&attr);
149
150 /* ʹ���� pthread_atfork() ������ fork �����������Ϊ�� fork ǰ���ù�
151 * �������̣������轫������Ϊ�ݹ��� --- zsx, 2019.8.6
152 */
153# if defined(ACL_FREEBSD) || defined(ACL_SUNOS5) || defined(ACL_MACOSX) || defined(ALPINE)
154 n2 = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
155# elif defined(MINGW)
156 n2 = 0;
157# elif defined(PTHREAD_MUTEX_RECURSIVE_NP)
158 n2 = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
159# else
160 n2 = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
161# endif
162 thread_mutex_init(lock, !n1 && !n2 ? &attr : NULL);
163#else
164 thread_mutex_init(lock, NULL);
165#endif
166}
167
168void acl_log_fp_set(ACL_VSTREAM *fp, const char *logpre)
169{

Callers 2

acl_log_fp_setFunction · 0.85
open_file_logFunction · 0.85

Calls 1

thread_mutex_initFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…