代码拉取完成,页面将自动刷新
#include "stdafx.h"
#include "thread_base.h"
#ifdef WIN32
#include <assert.h>
#include <process.h>
#else
#include <execinfo.h>
#endif
namespace base
{
#ifdef WIN32
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg)
{
void (*routine)(void *) = (void (*) (void *))start_routine;
return (int)_beginthread(routine, 0, arg);
}
pthread_t pthread_self(void)
{
return GetCurrentThreadId();
}
int pthread_join(pthread_t thread, void **retval)
{
assert(0);
return 0;
}
int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
assert(0);
return 0;
}
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
InitializeCriticalSection(mutex);
return 0;
}
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
EnterCriticalSection(mutex);
return 0;
}
int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
assert(0);
return 0;
}
int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
LeaveCriticalSection(mutex);
return 0;
}
int backtrace(void **buffer, int size)
{
assert(0);
return 0;
}
#else
int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine) (void *), void *arg)
{
return ::pthread_create(thread, attr, start_routine, arg);
}
pthread_t pthread_self(void)
{
return ::pthread_self();
}
int pthread_join(pthread_t thread, void **retval)
{
return ::pthread_join(thread, retval);
}
int pthread_mutex_destroy(pthread_mutex_t *mutex)
{
return ::pthread_mutex_destroy(mutex);
}
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr)
{
return ::pthread_mutex_init(mutex, attr);
}
int pthread_mutex_lock(pthread_mutex_t *mutex)
{
return ::pthread_mutex_lock(mutex);
}
int pthread_mutex_trylock(pthread_mutex_t *mutex)
{
return ::pthread_mutex_trylock(mutex);
}
int pthread_mutex_unlock(pthread_mutex_t *mutex)
{
return ::pthread_mutex_unlock(mutex);
}
int backtrace(void **buffer, int size)
{
return ::backtrace(buffer, size);
}
#endif
}//base
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。