forked from enlightenment/efl
meson.build verify if exists symbols thread_setname and thread_setaffinity for win32
This commit is contained in:
parent
0c7d90a12c
commit
8b4b7d0e64
|
@ -71,8 +71,8 @@
|
|||
#include "eina_debug_private.h"
|
||||
#include "eina_vpath.h"
|
||||
#include "eina_internal.h"
|
||||
// #include "eina_thread.h"
|
||||
#ifdef EINA_HAVE_THREAD_SETNAME
|
||||
#include "eina_thread.h"
|
||||
#ifdef EINA_HAVE_PTHREAD_SETNAME
|
||||
# ifndef __linux__
|
||||
# include <pthread_np.h>
|
||||
# endif
|
||||
|
@ -554,7 +554,7 @@ _monitor(void *_data)
|
|||
_opcodes_register_all(session);
|
||||
|
||||
// set a name for this thread for system debugging
|
||||
#ifdef EINA_HAVE_THREAD_SETNAME
|
||||
#ifdef EINA_HAVE_PTHREAD_SETNAME || EINA_HAVE_WIN32_THREAD_SETNAME
|
||||
eina_thread_name_set(eina_thread_self(), "Edbg-mon");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ _monitor(void *_data EINA_UNUSED)
|
|||
event.events = EPOLLIN;
|
||||
ret = epoll_ctl(epfd, EPOLL_CTL_ADD, event.data.fd, &event);
|
||||
if (ret) perror("epoll_ctl/add");
|
||||
# ifdef EINA_HAVE_THREAD_SETNAME
|
||||
# ifdef EINA_HAVE_PTHREAD_SETNAME || EINA_HAVE_WIN32_THREAD_SETNAME
|
||||
eina_thread_name_set(eina_thread_self(), "Edbg-tim");
|
||||
# endif
|
||||
|
||||
|
@ -177,7 +177,7 @@ eina_debug_timer_add(unsigned int timeout_ms, Eina_Debug_Timer_Cb cb, void *data
|
|||
# endif
|
||||
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
|
||||
#endif
|
||||
int err = eina_thread_create(&_thread, EINA_THREAD_BACKGROUND, NULL, _monitor, NULL);
|
||||
int err = eina_thread_create(&_thread, EINA_THREAD_BACKGROUND, NULL,(Eina_Thread_Cb)_monitor, NULL);
|
||||
#ifndef _WIN32
|
||||
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||||
#endif
|
||||
|
|
|
@ -102,8 +102,13 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
|
|||
|
||||
ret = (*t != NULL) ? EINA_TRUE : EINA_FALSE;
|
||||
|
||||
if (affinity >= 0 && ret) SetThreadAffinityMask(*t, (DWORD_PTR *)&affinity);
|
||||
|
||||
if (affinity >= 0 && ret)
|
||||
{
|
||||
#ifdef EINA_HAVE_WIN32_THREAD_AFFINITY
|
||||
SetThreadAffinityMask(*t, (DWORD_PTR *)&affinity);
|
||||
#endif
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#endif
|
||||
# include <string.h>
|
||||
|
||||
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_THREAD_SETNAME)
|
||||
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
|
||||
# define cpu_set_t cpuset_t
|
||||
#endif
|
||||
|
||||
|
@ -117,7 +117,7 @@ eina_thread_join(Eina_Thread t)
|
|||
EAPI Eina_Bool
|
||||
eina_thread_name_set(Eina_Thread t, const char *name)
|
||||
{
|
||||
#ifdef EINA_HAVE_THREAD_SETNAME
|
||||
#if defined(EINA_HAVE_PTHREAD_SETNAME) || defined(EINA_HAVE_WIN32_THREAD_SETNAME)
|
||||
char buf[16];
|
||||
if (name)
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#define EINA_THREAD_CANCEL_ASYNCHRONOUS PTHREAD_CANCEL_ASYNCHRONOUS
|
||||
#define EINA_THREAD_CANCELED PTHREAD_CANCELED
|
||||
|
||||
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_THREAD_SETNAME)
|
||||
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
|
||||
# ifndef __linux__
|
||||
# include <pthread_np.h>
|
||||
# define cpu_set_t cpuset_t
|
||||
|
|
|
@ -304,13 +304,21 @@ else
|
|||
endif
|
||||
|
||||
if cc.has_header_symbol(pthread_np_header_file, pthread_setname_np_api, args : pthread_args)
|
||||
eina_config.set('EINA_HAVE_THREAD_SETNAME', '1')
|
||||
eina_config.set('EINA_HAVE_PTHREAD_SETNAME', '1')
|
||||
endif
|
||||
|
||||
if cc.has_header_symbol('precessthreadspi.h', 'SetThreadDescription')
|
||||
eina_config.set('EINA_HAVE_WIN32_THREAD_SETNAME', '1')
|
||||
endif
|
||||
|
||||
if cc.has_header_symbol(pthread_np_header_file, 'pthread_attr_setaffinity_np', args : pthread_args)
|
||||
eina_config.set('EINA_HAVE_PTHREAD_AFFINITY', '1')
|
||||
endif
|
||||
|
||||
if cc.has_header_symbol('WinBase.h', 'SetThreadAffinityMask')
|
||||
eina_config.set('EINA_HAVE_WIN32_THREAD_AFFINITY', '1')
|
||||
endif
|
||||
|
||||
if debug_threads or get_option('debug-threads')
|
||||
if cc.has_header_symbol('execinfo.h', 'backtrace')
|
||||
eina_config.set('EINA_HAVE_DEBUG_THREADS', '1')
|
||||
|
|
Loading…
Reference in New Issue