removed unnecessary comments

This commit is contained in:
carlos 2020-03-20 15:59:32 -03:00 committed by João Paulo Taylor Ienczak Zanette
parent b7c43d51c1
commit 268178b9d5
3 changed files with 23 additions and 87 deletions

View File

@ -35,10 +35,9 @@
#include <pthread.h>
#include <errno.h>
#ifndef _WIN32
# include <signal.h>
#endif
# include <string.h>
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
#ifndef __linux__
@ -63,9 +62,9 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
{
int err;
pthread_attr_t attr;
#ifndef _WIN32
sigset_t oldset, newset;
#endif
pthread_attr_init(&attr);
if (affinity >= 0)
@ -80,7 +79,7 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
}
/* setup initial locks */
#ifndef _WIN32
sigemptyset(&newset);
sigaddset(&newset, SIGPIPE);
sigaddset(&newset, SIGALRM);
@ -95,11 +94,13 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
sigaddset(&newset, SIGPWR);
# endif
pthread_sigmask(SIG_BLOCK, &newset, &oldset);
#endif
err = pthread_create((pthread_t *)t, &attr, func, data);
#ifndef _WIN32
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
#endif
pthread_attr_destroy(&attr);
if (err == 0) return EINA_TRUE;
@ -118,33 +119,3 @@ _eina_thread_self(void)
{
return (Eina_Thread)pthread_self();
}
/*
void *
_eina_internal_call(void *context)
{
Eina_Thread_Call *c = context;
void *r;
pthread_t self;
// Default this thread to not cancellable as per Eina documentation
eina_thread_cancellable_set(EINA_FALSE, NULL);
EINA_THREAD_CLEANUP_PUSH(free, c);
if (c->prio == EINA_THREAD_BACKGROUND ||
c->prio == EINA_THREAD_IDLE)
eina_sched_prio_drop();
self = pthread_self();
_eina_debug_thread_add(&self);
EINA_THREAD_CLEANUP_PUSH(_eina_debug_thread_del, &self);
r = c->func((void*) c->data, eina_thread_self());
EINA_THREAD_CLEANUP_POP(EINA_TRUE);
EINA_THREAD_CLEANUP_POP(EINA_TRUE);
return r;
}
*/

View File

@ -41,10 +41,7 @@
#include <errno.h>
#ifndef _WIN32
# include <signal.h>
#endif
# include <string.h>
#include <string.h>
#if defined(EINA_HAVE_PTHREAD_AFFINITY) || defined(EINA_HAVE_PTHREAD_SETNAME)
#ifndef __linux__
@ -68,11 +65,10 @@ typedef struct _Eina_win32_thread_attr{
inline void *
_eina_thread_join(Eina_Thread t)
{
//void *ret = NULL;
//int timeout_millis = 10000;
int ret = (int)WaitForSingleObject(t,INFINITE);//int ret = pthread_join((pthread_t)t, &ret);
int ret = (int)WaitForSingleObject(t,INFINITE);
if (ret != 0) return ret;//if (ret == 0) return ret;
if (ret != 0) return ret;
return NULL;
}
@ -85,7 +81,7 @@ DWORD WINAPI _eina_thread_func(void *params)
void _eina_thread_set_priority(Eina_Thread_Priority prio, Eina_Thread *t){
//HANDLE hThread;
int nPriority;
switch(prio){
@ -117,7 +113,7 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
LPDWORD threadID;
//Eina_win32_thread_func *thread_func = (Eina_win32_thread_func*) malloc(sizeof(Eina_win32_thread_func));
Eina_win32_thread_func thread_func;
Eina_Thread_Call *c = (Eina_Thread_Call*)(data);
@ -128,12 +124,11 @@ _eina_thread_create(Eina_Thread *t, int affinity, void *(*func)(void *data), voi
*t =(HANDLE) CreateThread(thread_attr.lpThreadAttributes,thread_attr.dwStackSize, &_eina_thread_func,&thread_func,thread_attr.dwCreationFlags,threadID);
//free(thread_func);
_eina_thread_set_priority(c->prio,t); //SetThreadPriority(*t, c->prio);
_eina_thread_set_priority(c->prio,t);
ret = (*t != NULL) ? EINA_TRUE : EINA_FALSE;
@ -162,15 +157,15 @@ _eina_thread_equal(Eina_Thread t1, Eina_Thread t2)
DWORD t2_thread_id = GetThreadId((HANDLE)t2);
return (t1_thread_id == t2_thread_id) ? EINA_TRUE : EINA_FALSE;
//return pthread_equal((pthread_t)t1, (pthread_t)t2);
}
inline Eina_Thread
_eina_thread_self(void)
{
//return (Eina_Thread)GetCurrentThreadId();
return (Eina_Thread)GetCurrentThread();
//return (Eina_Thread)pthread_self();
}
HRESULT _eina_thread_set_name_win32(Eina_Thread thread, char *buf){
@ -183,7 +178,7 @@ Eina_Bool _eina_thread_cancel(Eina_Thread thread){
ExitThread(*lpExitCode);
return success;
//return SetThreadDescription((HANDLE)thread, (PCWSTR)buf);
}

View File

@ -142,25 +142,13 @@ UNIMPLEMENTED inline int pthread_getschedparam(void* a, ...)
#warning pthread_getschedparam is not implemented.
return 0;
}
/*
UNIMPLEMENTED inline int pthread_self()
{
#warning pthread_self is not implemented.
return 0;
}*/
UNIMPLEMENTED inline int pthread_setschedparam(void* c, void* d, void* e)
{
#warning pthread_ is not implemented.
return 0;
}
/*
UNIMPLEMENTED inline int pthread_cancel(void* a, ...)
{
#warning pthread_cancel is not implemented.
return 0;
}
*/
UNIMPLEMENTED inline int pthread_setcancelstate(void* a, ...)
{
#warning pthread_setcancelstate is not implemented.
@ -190,25 +178,7 @@ UNIMPLEMENTED inline int pthread_attr_init(void* a, ...)
#warning pthread_attr_init is not implemented.
return 0;
}
/*
UNIMPLEMENTED inline int pthread_join(void* a, ...)
{
#warning pthread_join is not implemented.
return 0;
}
UNIMPLEMENTED inline int pthread_create(void* a, ...)
{
#warning pthread_create is not implemented.
return 0;
}
UNIMPLEMENTED inline int pthread_equal(void* a, ...)
{
#warning pthread_equal is not implemented.
return 0;
}
*/
UNIMPLEMENTED inline int pthread_setcanceltype(void* a, ...)
{
#warning pthread_setcanceltype is not implemented.