forked from enlightenment/efl
no need for ref count in ecore_thread init/shutdown functions
SVN revision: 42991
This commit is contained in:
parent
b1cc741a2d
commit
43d3c84907
|
@ -444,8 +444,8 @@ void _ecore_fps_debug_init(void);
|
||||||
void _ecore_fps_debug_shutdown(void);
|
void _ecore_fps_debug_shutdown(void);
|
||||||
void _ecore_fps_debug_runtime_add(double t);
|
void _ecore_fps_debug_runtime_add(double t);
|
||||||
|
|
||||||
int _ecore_thread_init(void);
|
void _ecore_thread_init(void);
|
||||||
int _ecore_thread_shutdown(void);
|
void _ecore_thread_shutdown(void);
|
||||||
|
|
||||||
void _ecore_glib_init(void);
|
void _ecore_glib_init(void);
|
||||||
void _ecore_glib_shutdown(void);
|
void _ecore_glib_shutdown(void);
|
||||||
|
|
|
@ -27,7 +27,6 @@ struct _Ecore_Pthread_Worker
|
||||||
static int _ecore_thread_count_max = 0;
|
static int _ecore_thread_count_max = 0;
|
||||||
static int _ecore_thread_count = 0;
|
static int _ecore_thread_count = 0;
|
||||||
|
|
||||||
static int _ecore_thread_initcount = 0;
|
|
||||||
static Eina_List *_ecore_thread = NULL;
|
static Eina_List *_ecore_thread = NULL;
|
||||||
static int ECORE_THREAD_PIPE_DEL = 0;
|
static int ECORE_THREAD_PIPE_DEL = 0;
|
||||||
static Ecore_Event_Handler *del_handler = NULL;
|
static Ecore_Event_Handler *del_handler = NULL;
|
||||||
|
@ -133,13 +132,9 @@ _ecore_thread_handler(void *data __UNUSED__, void *buffer, unsigned int nbyte)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int
|
void
|
||||||
_ecore_thread_init(void)
|
_ecore_thread_init(void)
|
||||||
{
|
{
|
||||||
_ecore_thread_initcount++;
|
|
||||||
|
|
||||||
if (_ecore_thread_initcount > 1) return _ecore_thread_initcount;
|
|
||||||
|
|
||||||
_ecore_thread_count_max = eina_cpu_count();
|
_ecore_thread_count_max = eina_cpu_count();
|
||||||
if (_ecore_thread_count_max <= 0)
|
if (_ecore_thread_count_max <= 0)
|
||||||
_ecore_thread_count_max = 1;
|
_ecore_thread_count_max = 1;
|
||||||
|
@ -148,24 +143,16 @@ _ecore_thread_init(void)
|
||||||
#ifdef BUILD_PTHREAD
|
#ifdef BUILD_PTHREAD
|
||||||
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
|
del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL);
|
||||||
#endif
|
#endif
|
||||||
return _ecore_thread_initcount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
_ecore_thread_shutdown(void)
|
_ecore_thread_shutdown(void)
|
||||||
{
|
{
|
||||||
_ecore_thread_initcount--;
|
/* FIXME: If function are still running in the background, should we kill them ? */
|
||||||
|
|
||||||
if (!_ecore_thread_initcount)
|
|
||||||
{
|
|
||||||
/* FIXME: If function are still running in the background, should we kill them ? */
|
|
||||||
#ifdef BUILD_PTHREAD
|
#ifdef BUILD_PTHREAD
|
||||||
ecore_event_handler_del(del_handler);
|
ecore_event_handler_del(del_handler);
|
||||||
del_handler = NULL;
|
del_handler = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
return _ecore_thread_initcount;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue