forked from enlightenment/efl
parent
0aaad2d41e
commit
16263f52cc
|
@ -107,23 +107,23 @@ extern "C" {
|
|||
|
||||
enum _Ecore_Fd_Handler_Flags
|
||||
{
|
||||
ECORE_FD_READ = 1, /**< Fd Read mask */
|
||||
ECORE_FD_WRITE = 2, /**< Fd Write mask */
|
||||
ECORE_FD_ERROR = 4 /**< Fd Error mask */
|
||||
ECORE_FD_READ = 1, /**< Fd Read mask */
|
||||
ECORE_FD_WRITE = 2, /**< Fd Write mask */
|
||||
ECORE_FD_ERROR = 4 /**< Fd Error mask */
|
||||
};
|
||||
typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags;
|
||||
|
||||
enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */
|
||||
{
|
||||
ECORE_EXE_PIPE_READ = 1, /**< Exe Pipe Read mask */
|
||||
ECORE_EXE_PIPE_WRITE = 2, /**< Exe Pipe Write mask */
|
||||
ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and delivered 1 event per line */
|
||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and delivered 1 event per line */
|
||||
ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
|
||||
ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
|
||||
ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
|
||||
ECORE_EXE_NOT_LEADER = 256 /**< Do not use setsid() to have the executed process be its own session leader */
|
||||
ECORE_EXE_PIPE_READ = 1, /**< Exe Pipe Read mask */
|
||||
ECORE_EXE_PIPE_WRITE = 2, /**< Exe Pipe Write mask */
|
||||
ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */
|
||||
ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and delivered 1 event per line */
|
||||
ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and delivered 1 event per line */
|
||||
ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */
|
||||
ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */
|
||||
ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */
|
||||
ECORE_EXE_NOT_LEADER = 256 /**< Do not use setsid() to have the executed process be its own session leader */
|
||||
};
|
||||
typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags;
|
||||
|
||||
|
@ -140,7 +140,7 @@ extern "C" {
|
|||
|
||||
enum _Ecore_Poller_Type /* Poller types */
|
||||
{
|
||||
ECORE_POLLER_CORE = 0 /**< The core poller interval */
|
||||
ECORE_POLLER_CORE = 0 /**< The core poller interval */
|
||||
};
|
||||
typedef enum _Ecore_Poller_Type Ecore_Poller_Type;
|
||||
|
||||
|
@ -244,85 +244,85 @@ extern "C" {
|
|||
|
||||
struct _Ecore_Event_Signal_User /** User signal event */
|
||||
{
|
||||
int number; /**< The signal number. Either 1 or 2 */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
int number; /**< The signal number. Either 1 or 2 */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Event_Signal_Hup /** Hup signal event */
|
||||
{
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Event_Signal_Exit /** Exit request event */
|
||||
{
|
||||
unsigned int interrupt : 1; /**< Set if the exit request was an interrupt signal*/
|
||||
unsigned int quit : 1; /**< set if the exit request was a quit signal */
|
||||
unsigned int terminate : 1; /**< Set if the exit request was a terminate singal */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
unsigned int interrupt : 1; /**< Set if the exit request was an interrupt signal*/
|
||||
unsigned int quit : 1; /**< set if the exit request was a quit signal */
|
||||
unsigned int terminate : 1; /**< Set if the exit request was a terminate singal */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Event_Signal_Power /** Power event */
|
||||
{
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Event_Signal_Realtime /** Realtime event */
|
||||
{
|
||||
int num; /**< The realtime signal's number */
|
||||
int num; /**< The realtime signal's number */
|
||||
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Exe_Event_Add /** Process add event */
|
||||
{
|
||||
Ecore_Exe *exe; /**< The handle to the added process */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
Ecore_Exe *exe; /**< The handle to the added process */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
};
|
||||
|
||||
struct _Ecore_Exe_Event_Del /** Process exit event */
|
||||
{
|
||||
pid_t pid; /**< The process ID of the process that exited */
|
||||
int exit_code; /**< The exit code of the process */
|
||||
Ecore_Exe *exe; /**< The handle to the exited process, or NULL if not found */
|
||||
int exit_signal; /** < The signal that caused the process to exit */
|
||||
unsigned int exited : 1; /** < set to 1 if the process exited of its own accord */
|
||||
unsigned int signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
pid_t pid; /**< The process ID of the process that exited */
|
||||
int exit_code; /**< The exit code of the process */
|
||||
Ecore_Exe *exe; /**< The handle to the exited process, or NULL if not found */
|
||||
int exit_signal; /** < The signal that caused the process to exit */
|
||||
unsigned int exited : 1; /** < set to 1 if the process exited of its own accord */
|
||||
unsigned int signalled : 1; /** < set to 1 id the process exited due to uncaught signal */
|
||||
void *ext_data; /**< Extension data - not used */
|
||||
#ifndef _WIN32
|
||||
siginfo_t data; /**< Signal info */
|
||||
siginfo_t data; /**< Signal info */
|
||||
#endif
|
||||
};
|
||||
|
||||
struct _Ecore_Exe_Event_Data_Line /**< Lines from a child process */
|
||||
{
|
||||
char *line;
|
||||
int size;
|
||||
int size;
|
||||
};
|
||||
|
||||
struct _Ecore_Exe_Event_Data /** Data from a child process event */
|
||||
{
|
||||
Ecore_Exe *exe; /**< The handle to the process */
|
||||
void *data; /**< the raw binary data from the child process that was received */
|
||||
int size; /**< the size of this data in bytes */
|
||||
Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */
|
||||
Ecore_Exe *exe; /**< The handle to the process */
|
||||
void *data; /**< the raw binary data from the child process that was received */
|
||||
int size; /**< the size of this data in bytes */
|
||||
Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */
|
||||
};
|
||||
|
||||
EAPI int ecore_init(void);
|
||||
|
@ -413,11 +413,11 @@ extern "C" {
|
|||
Ecore_Cb,
|
||||
const void *data);
|
||||
EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Heavy_Cb,
|
||||
Ecore_Thread_Notify_Cb,
|
||||
Ecore_Cb,
|
||||
Ecore_Cb,
|
||||
const void *data,
|
||||
Eina_Bool try_no_queue);
|
||||
Ecore_Thread_Notify_Cb,
|
||||
Ecore_Cb,
|
||||
Ecore_Cb,
|
||||
const void *data,
|
||||
Eina_Bool try_no_queue);
|
||||
EAPI Eina_Bool ecore_thread_cancel(Ecore_Thread *thread);
|
||||
EAPI Eina_Bool ecore_thread_check(Ecore_Thread *thread);
|
||||
EAPI Eina_Bool ecore_thread_feedback(Ecore_Thread *thread, const void *msg_data);
|
||||
|
@ -463,8 +463,8 @@ extern "C" {
|
|||
|
||||
EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, const void *data);
|
||||
EAPI void *ecore_animator_del(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_freeze(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_thaw(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_freeze(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_thaw(Ecore_Animator *animator);
|
||||
EAPI void ecore_animator_frametime_set(double frametime);
|
||||
EAPI double ecore_animator_frametime_get(void);
|
||||
|
||||
|
|
|
@ -114,15 +114,15 @@ extern "C" {
|
|||
Ecore_Getopt_Desc_Arg_Requirement arg_req;
|
||||
union
|
||||
{
|
||||
const char *strv;
|
||||
unsigned char boolv;
|
||||
short shortv;
|
||||
int intv;
|
||||
long longv;
|
||||
unsigned short ushortv;
|
||||
unsigned int uintv;
|
||||
unsigned long ulongv;
|
||||
double doublev;
|
||||
const char *strv;
|
||||
unsigned char boolv;
|
||||
short shortv;
|
||||
int intv;
|
||||
long longv;
|
||||
unsigned short ushortv;
|
||||
unsigned int uintv;
|
||||
unsigned long ulongv;
|
||||
double doublev;
|
||||
} def;
|
||||
};
|
||||
|
||||
|
@ -144,12 +144,12 @@ extern "C" {
|
|||
Ecore_Getopt_Action action; /**< define how to handle it */
|
||||
union
|
||||
{
|
||||
const Ecore_Getopt_Desc_Store store;
|
||||
const void *store_const;
|
||||
const char *const *choices; /* NULL terminated. */
|
||||
const Ecore_Getopt_Type append_type;
|
||||
const Ecore_Getopt_Desc_Callback callback;
|
||||
const void *dummy;
|
||||
const Ecore_Getopt_Desc_Store store;
|
||||
const void *store_const;
|
||||
const char *const *choices; /* NULL terminated. */
|
||||
const Ecore_Getopt_Type append_type;
|
||||
const Ecore_Getopt_Desc_Callback callback;
|
||||
const void *dummy;
|
||||
} action_param;
|
||||
};
|
||||
|
||||
|
@ -166,12 +166,12 @@ extern "C" {
|
|||
};
|
||||
|
||||
#define ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, arg_requirement, default_value) \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_STORE, \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_STORE, \
|
||||
{.store = {type, arg_requirement, default_value}}}
|
||||
|
||||
#define ECORE_GETOPT_STORE(shortname, longname, help, type) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
|
||||
|
||||
#define ECORE_GETOPT_STORE_STR(shortname, longname, help) \
|
||||
ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_STR)
|
||||
|
@ -194,8 +194,8 @@ extern "C" {
|
|||
|
||||
|
||||
#define ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, type) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {})
|
||||
|
||||
#define ECORE_GETOPT_STORE_METAVAR_STR(shortname, longname, help, metavar) \
|
||||
ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_STR)
|
||||
|
@ -218,155 +218,155 @@ extern "C" {
|
|||
|
||||
|
||||
#define ECORE_GETOPT_STORE_DEF(shortname, longname, help, type, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL, \
|
||||
default_value)
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL, \
|
||||
default_value)
|
||||
|
||||
#define ECORE_GETOPT_STORE_DEF_STR(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_STR, \
|
||||
{.strv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_STR, \
|
||||
{.strv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_BOOL(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_BOOL, \
|
||||
{.boolv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_BOOL, \
|
||||
{.boolv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_SHORT(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_SHORT, \
|
||||
{.shortv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_SHORT, \
|
||||
{.shortv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_INT(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_INT, \
|
||||
{.intv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_INT, \
|
||||
{.intv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_LONG(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_LONG, \
|
||||
{.longv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_LONG, \
|
||||
{.longv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_USHORT(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_USHORT, \
|
||||
{.ushortv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_USHORT, \
|
||||
{.ushortv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_UINT(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_UINT, \
|
||||
{.uintv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_UINT, \
|
||||
{.uintv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_ULONG(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_ULONG, \
|
||||
{.ulongv = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_ULONG, \
|
||||
{.ulongv = default_value})
|
||||
#define ECORE_GETOPT_STORE_DEF_DOUBLE(shortname, longname, help, default_value) \
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_DOUBLE, \
|
||||
{.doublev = default_value})
|
||||
ECORE_GETOPT_STORE_DEF(shortname, longname, help, \
|
||||
ECORE_GETOPT_TYPE_DOUBLE, \
|
||||
{.doublev = default_value})
|
||||
|
||||
#define ECORE_GETOPT_STORE_FULL_STR(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_STR, \
|
||||
arg_requirement, \
|
||||
{.strv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_STR, \
|
||||
arg_requirement, \
|
||||
{.strv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_BOOL(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_BOOL, \
|
||||
arg_requirement, \
|
||||
{.boolv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_BOOL, \
|
||||
arg_requirement, \
|
||||
{.boolv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_SHORT(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_SHORT, \
|
||||
arg_requirement, \
|
||||
{.shortv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_SHORT, \
|
||||
arg_requirement, \
|
||||
{.shortv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_INT(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_INT, \
|
||||
arg_requirement, \
|
||||
{.intv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_INT, \
|
||||
arg_requirement, \
|
||||
{.intv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_LONG(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_LONG, \
|
||||
arg_requirement, \
|
||||
{.longv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_LONG, \
|
||||
arg_requirement, \
|
||||
{.longv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_USHORT(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_USHORT, \
|
||||
arg_requirement, \
|
||||
{.ushortv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_USHORT, \
|
||||
arg_requirement, \
|
||||
{.ushortv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_UINT(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_UINT, \
|
||||
arg_requirement, \
|
||||
{.uintv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_UINT, \
|
||||
arg_requirement, \
|
||||
{.uintv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_ULONG(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_ULONG, \
|
||||
arg_requirement, \
|
||||
{.ulongv = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_ULONG, \
|
||||
arg_requirement, \
|
||||
{.ulongv = default_value})
|
||||
#define ECORE_GETOPT_STORE_FULL_DOUBLE(shortname, longname, help, metavar, arg_requirement, default_value) \
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_DOUBLE, \
|
||||
arg_requirement, \
|
||||
{.doublev = default_value})
|
||||
ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \
|
||||
ECORE_GETOPT_TYPE_DOUBLE, \
|
||||
arg_requirement, \
|
||||
{.doublev = default_value})
|
||||
|
||||
#define ECORE_GETOPT_STORE_CONST(shortname, longname, help, value) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_CONST, \
|
||||
#define ECORE_GETOPT_STORE_CONST(shortname, longname, help, value) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_CONST, \
|
||||
{.store_const = value}}
|
||||
#define ECORE_GETOPT_STORE_TRUE(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_TRUE, \
|
||||
#define ECORE_GETOPT_STORE_TRUE(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_TRUE, \
|
||||
{.dummy = NULL}}
|
||||
#define ECORE_GETOPT_STORE_FALSE(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_FALSE, \
|
||||
#define ECORE_GETOPT_STORE_FALSE(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_FALSE, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_CHOICE(shortname, longname, help, choices_array) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_CHOICE, \
|
||||
#define ECORE_GETOPT_CHOICE(shortname, longname, help, choices_array) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_CHOICE, \
|
||||
{.choices = choices_array}}
|
||||
#define ECORE_GETOPT_CHOICE_METAVAR(shortname, longname, help, metavar, choices_array) \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CHOICE, \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CHOICE, \
|
||||
{.choices = choices_array}}
|
||||
|
||||
|
||||
#define ECORE_GETOPT_APPEND(shortname, longname, help, sub_type) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_APPEND, \
|
||||
#define ECORE_GETOPT_APPEND(shortname, longname, help, sub_type) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_APPEND, \
|
||||
{.append_type = sub_type}}
|
||||
#define ECORE_GETOPT_APPEND_METAVAR(shortname, longname, help, metavar, type) \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_APPEND, \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_APPEND, \
|
||||
{.append_type = type}}
|
||||
|
||||
#define ECORE_GETOPT_COUNT(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_COUNT, \
|
||||
#define ECORE_GETOPT_COUNT(shortname, longname, help) \
|
||||
{shortname, longname, help, NULL, ECORE_GETOPT_ACTION_COUNT, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, callback_func, callback_data, argument_requirement, default_value) \
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CALLBACK, \
|
||||
{.callback = {callback_func, callback_data, \
|
||||
argument_requirement, default_value}}}
|
||||
{shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CALLBACK, \
|
||||
{.callback = {callback_func, callback_data, \
|
||||
argument_requirement, default_value}}}
|
||||
#define ECORE_GETOPT_CALLBACK_NOARGS(shortname, longname, help, callback_func, callback_data) \
|
||||
ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, NULL, \
|
||||
callback_func, callback_data, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO, \
|
||||
NULL)
|
||||
ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, NULL, \
|
||||
callback_func, callback_data, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO, \
|
||||
NULL)
|
||||
#define ECORE_GETOPT_CALLBACK_ARGS(shortname, longname, help, metavar, callback_func, callback_data) \
|
||||
ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, \
|
||||
callback_func, callback_data, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, \
|
||||
NULL)
|
||||
ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, \
|
||||
callback_func, callback_data, \
|
||||
ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, \
|
||||
NULL)
|
||||
|
||||
#define ECORE_GETOPT_HELP(shortname, longname) \
|
||||
{shortname, longname, "show this message.", NULL, \
|
||||
ECORE_GETOPT_ACTION_HELP, \
|
||||
#define ECORE_GETOPT_HELP(shortname, longname) \
|
||||
{shortname, longname, "show this message.", NULL, \
|
||||
ECORE_GETOPT_ACTION_HELP, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_VERSION(shortname, longname) \
|
||||
{shortname, longname, "show program version.", NULL, \
|
||||
ECORE_GETOPT_ACTION_VERSION, \
|
||||
#define ECORE_GETOPT_VERSION(shortname, longname) \
|
||||
{shortname, longname, "show program version.", NULL, \
|
||||
ECORE_GETOPT_ACTION_VERSION, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_COPYRIGHT(shortname, longname) \
|
||||
{shortname, longname, "show copyright.", NULL, \
|
||||
ECORE_GETOPT_ACTION_COPYRIGHT, \
|
||||
#define ECORE_GETOPT_COPYRIGHT(shortname, longname) \
|
||||
{shortname, longname, "show copyright.", NULL, \
|
||||
ECORE_GETOPT_ACTION_COPYRIGHT, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_LICENSE(shortname, longname) \
|
||||
{shortname, longname, "show license.", NULL, \
|
||||
ECORE_GETOPT_ACTION_LICENSE, \
|
||||
#define ECORE_GETOPT_LICENSE(shortname, longname) \
|
||||
{shortname, longname, "show license.", NULL, \
|
||||
ECORE_GETOPT_ACTION_LICENSE, \
|
||||
{.dummy = NULL}}
|
||||
|
||||
#define ECORE_GETOPT_SENTINEL {0, NULL, NULL, NULL, 0, {.dummy = NULL}}
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
static Ecore_Version _version = { VERS_MAJ, VERS_MIN, VERS_MIC, VERS_REV };
|
||||
EAPI Ecore_Version *ecore_version = &_version;
|
||||
|
||||
#define KEEP_MAX(Global, Local) \
|
||||
if (Global < (Local)) \
|
||||
#define KEEP_MAX(Global, Local) \
|
||||
if (Global < (Local)) \
|
||||
Global = Local;
|
||||
|
||||
static Eina_Bool _ecore_memory_statistic(void *data);
|
||||
|
@ -95,7 +95,7 @@ ecore_init(void)
|
|||
/*
|
||||
if (strcmp(nl_langinfo(CODESET), "UTF-8"))
|
||||
{
|
||||
WRN("Not a utf8 locale!");
|
||||
WRN("Not a utf8 locale!");
|
||||
}
|
||||
*/
|
||||
#ifdef HAVE_EVIL
|
||||
|
@ -122,8 +122,8 @@ ecore_init(void)
|
|||
#if HAVE_MALLINFO
|
||||
if (getenv("ECORE_MEM_STAT"))
|
||||
{
|
||||
_ecore_memory_pid = getpid();
|
||||
ecore_animator_add(_ecore_memory_statistic, NULL);
|
||||
_ecore_memory_pid = getpid();
|
||||
ecore_animator_add(_ecore_memory_statistic, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -177,12 +177,12 @@ ecore_shutdown(void)
|
|||
#if HAVE_MALLINFO
|
||||
if (getenv("ECORE_MEM_STAT"))
|
||||
{
|
||||
_ecore_memory_statistic(NULL);
|
||||
_ecore_memory_statistic(NULL);
|
||||
|
||||
ERR("[%i] Memory MAX total: %i, free: %i",
|
||||
_ecore_memory_pid,
|
||||
_ecore_memory_max_total,
|
||||
_ecore_memory_max_free);
|
||||
ERR("[%i] Memory MAX total: %i, free: %i",
|
||||
_ecore_memory_pid,
|
||||
_ecore_memory_max_total,
|
||||
_ecore_memory_max_free);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -220,13 +220,13 @@ _ecore_magic_fail(const void *d, Ecore_Magic m, Ecore_Magic req_m, const char *f
|
|||
ERR(" Input handle has already been freed!");
|
||||
else if (m != req_m)
|
||||
ERR(" Input handle is wrong type\n"
|
||||
" Expected: %08x - %s\n"
|
||||
" Supplied: %08x - %s",
|
||||
(unsigned int)req_m, _ecore_magic_string_get(req_m),
|
||||
(unsigned int)m, _ecore_magic_string_get(m));
|
||||
" Expected: %08x - %s\n"
|
||||
" Supplied: %08x - %s",
|
||||
(unsigned int)req_m, _ecore_magic_string_get(req_m),
|
||||
(unsigned int)m, _ecore_magic_string_get(m));
|
||||
ERR("*** NAUGHTY PROGRAMMER!!!\n"
|
||||
"*** SPANK SPANK SPANK!!!\n"
|
||||
"*** Now go fix your code. Tut tut tut!");
|
||||
"*** SPANK SPANK SPANK!!!\n"
|
||||
"*** Now go fix your code. Tut tut tut!");
|
||||
if (getenv("ECORE_ERROR_ABORT")) abort();
|
||||
}
|
||||
|
||||
|
@ -236,37 +236,37 @@ _ecore_magic_string_get(Ecore_Magic m)
|
|||
switch (m)
|
||||
{
|
||||
case ECORE_MAGIC_NONE:
|
||||
return "None (Freed Object)";
|
||||
break;
|
||||
return "None (Freed Object)";
|
||||
break;
|
||||
case ECORE_MAGIC_EXE:
|
||||
return "Ecore_Exe (Executable)";
|
||||
break;
|
||||
return "Ecore_Exe (Executable)";
|
||||
break;
|
||||
case ECORE_MAGIC_TIMER:
|
||||
return "Ecore_Timer (Timer)";
|
||||
break;
|
||||
return "Ecore_Timer (Timer)";
|
||||
break;
|
||||
case ECORE_MAGIC_IDLER:
|
||||
return "Ecore_Idler (Idler)";
|
||||
break;
|
||||
return "Ecore_Idler (Idler)";
|
||||
break;
|
||||
case ECORE_MAGIC_IDLE_ENTERER:
|
||||
return "Ecore_Idle_Enterer (Idler Enterer)";
|
||||
break;
|
||||
return "Ecore_Idle_Enterer (Idler Enterer)";
|
||||
break;
|
||||
case ECORE_MAGIC_IDLE_EXITER:
|
||||
return "Ecore_Idle_Exiter (Idler Exiter)";
|
||||
break;
|
||||
return "Ecore_Idle_Exiter (Idler Exiter)";
|
||||
break;
|
||||
case ECORE_MAGIC_FD_HANDLER:
|
||||
return "Ecore_Fd_Handler (Fd Handler)";
|
||||
break;
|
||||
return "Ecore_Fd_Handler (Fd Handler)";
|
||||
break;
|
||||
case ECORE_MAGIC_WIN32_HANDLER:
|
||||
return "Ecore_Win32_Handler (Win32 Handler)";
|
||||
break;
|
||||
return "Ecore_Win32_Handler (Win32 Handler)";
|
||||
break;
|
||||
case ECORE_MAGIC_EVENT_HANDLER:
|
||||
return "Ecore_Event_Handler (Event Handler)";
|
||||
break;
|
||||
return "Ecore_Event_Handler (Event Handler)";
|
||||
break;
|
||||
case ECORE_MAGIC_EVENT:
|
||||
return "Ecore_Event (Event)";
|
||||
break;
|
||||
return "Ecore_Event (Event)";
|
||||
break;
|
||||
default:
|
||||
return "<UNKNOWN>";
|
||||
return "<UNKNOWN>";
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -298,40 +298,40 @@ _ecore_fps_debug_init(void)
|
|||
_ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
|
||||
if (_ecore_fps_debug_fd < 0)
|
||||
{
|
||||
unlink(buf);
|
||||
_ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
|
||||
unlink(buf);
|
||||
_ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644);
|
||||
}
|
||||
if (_ecore_fps_debug_fd >= 0)
|
||||
{
|
||||
unsigned int zero = 0;
|
||||
char *buf = (char *)&zero;
|
||||
ssize_t todo = sizeof(unsigned int);
|
||||
unsigned int zero = 0;
|
||||
char *buf = (char *)&zero;
|
||||
ssize_t todo = sizeof(unsigned int);
|
||||
|
||||
while (todo > 0)
|
||||
{
|
||||
ssize_t r = write(_ecore_fps_debug_fd, buf, todo);
|
||||
if (r > 0)
|
||||
{
|
||||
todo -= r;
|
||||
buf += r;
|
||||
}
|
||||
else if ((r < 0) && (errno == EINTR))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
ERR("could not write to file '%s' fd %d: %s",
|
||||
tmp, _ecore_fps_debug_fd, strerror(errno));
|
||||
close(_ecore_fps_debug_fd);
|
||||
_ecore_fps_debug_fd = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED,
|
||||
_ecore_fps_debug_fd, 0);
|
||||
if (_ecore_fps_runtime_mmap == MAP_FAILED)
|
||||
_ecore_fps_runtime_mmap = NULL;
|
||||
while (todo > 0)
|
||||
{
|
||||
ssize_t r = write(_ecore_fps_debug_fd, buf, todo);
|
||||
if (r > 0)
|
||||
{
|
||||
todo -= r;
|
||||
buf += r;
|
||||
}
|
||||
else if ((r < 0) && (errno == EINTR))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
ERR("could not write to file '%s' fd %d: %s",
|
||||
tmp, _ecore_fps_debug_fd, strerror(errno));
|
||||
close(_ecore_fps_debug_fd);
|
||||
_ecore_fps_debug_fd = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int),
|
||||
PROT_READ | PROT_WRITE,
|
||||
MAP_SHARED,
|
||||
_ecore_fps_debug_fd, 0);
|
||||
if (_ecore_fps_runtime_mmap == MAP_FAILED)
|
||||
_ecore_fps_runtime_mmap = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -352,15 +352,15 @@ _ecore_fps_debug_shutdown(void)
|
|||
tmp = (char *)evil_tmpdir_get ();
|
||||
#endif /* HAVE_EVIL */
|
||||
pid = (int)getpid();
|
||||
snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
|
||||
unlink(buf);
|
||||
if (_ecore_fps_runtime_mmap)
|
||||
{
|
||||
munmap(_ecore_fps_runtime_mmap, sizeof(int));
|
||||
_ecore_fps_runtime_mmap = NULL;
|
||||
}
|
||||
close(_ecore_fps_debug_fd);
|
||||
_ecore_fps_debug_fd = -1;
|
||||
snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid);
|
||||
unlink(buf);
|
||||
if (_ecore_fps_runtime_mmap)
|
||||
{
|
||||
munmap(_ecore_fps_runtime_mmap, sizeof(int));
|
||||
_ecore_fps_runtime_mmap = NULL;
|
||||
}
|
||||
close(_ecore_fps_debug_fd);
|
||||
_ecore_fps_debug_fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,16 +370,16 @@ _ecore_fps_debug_runtime_add(double t)
|
|||
if ((_ecore_fps_debug_fd >= 0) &&
|
||||
(_ecore_fps_runtime_mmap))
|
||||
{
|
||||
unsigned int tm;
|
||||
unsigned int tm;
|
||||
|
||||
tm = (unsigned int)(t * 1000000.0);
|
||||
/* i know its not 100% theoretically guaranteed, but i'd say a write */
|
||||
/* of an int could be considered atomic for all practical purposes */
|
||||
/* oh and since this is cumulative, 1 second = 1,000,000 ticks, so */
|
||||
/* this can run for about 4294 seconds becore looping. if you are */
|
||||
/* doing performance testing in one run for over an hour... well */
|
||||
/* time to restart or handle a loop condition :) */
|
||||
*(_ecore_fps_runtime_mmap) += tm;
|
||||
tm = (unsigned int)(t * 1000000.0);
|
||||
/* i know its not 100% theoretically guaranteed, but i'd say a write */
|
||||
/* of an int could be considered atomic for all practical purposes */
|
||||
/* oh and since this is cumulative, 1 second = 1,000,000 ticks, so */
|
||||
/* this can run for about 4294 seconds becore looping. if you are */
|
||||
/* doing performance testing in one run for over an hour... well */
|
||||
/* time to restart or handle a loop condition :) */
|
||||
*(_ecore_fps_runtime_mmap) += tm;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -394,11 +394,11 @@ _ecore_memory_statistic(__UNUSED__ void *data)
|
|||
|
||||
mi = mallinfo();
|
||||
|
||||
#define HAS_CHANGED(Global, Local) \
|
||||
if (Global != Local) \
|
||||
{ \
|
||||
Global = Local; \
|
||||
changed = EINA_TRUE; \
|
||||
#define HAS_CHANGED(Global, Local) \
|
||||
if (Global != Local) \
|
||||
{ \
|
||||
Global = Local; \
|
||||
changed = EINA_TRUE; \
|
||||
}
|
||||
|
||||
HAS_CHANGED(uordblks, mi.uordblks);
|
||||
|
@ -406,9 +406,9 @@ _ecore_memory_statistic(__UNUSED__ void *data)
|
|||
|
||||
if (changed)
|
||||
ERR("[%i] Memory total: %i, free: %i",
|
||||
_ecore_memory_pid,
|
||||
mi.uordblks,
|
||||
mi.fordblks);
|
||||
_ecore_memory_pid,
|
||||
mi.uordblks,
|
||||
mi.fordblks);
|
||||
|
||||
KEEP_MAX(_ecore_memory_max_total, mi.uordblks);
|
||||
KEEP_MAX(_ecore_memory_max_free, mi.fordblks);
|
||||
|
|
|
@ -18,7 +18,7 @@ struct _Ecore_Animator
|
|||
void *data;
|
||||
|
||||
Eina_Bool delete_me : 1;
|
||||
Eina_Bool suspended : 1;
|
||||
Eina_Bool suspended : 1;
|
||||
};
|
||||
|
||||
|
||||
|
@ -87,9 +87,9 @@ ecore_animator_del(Ecore_Animator *animator)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return NULL;
|
||||
}
|
||||
if (animator->delete_me) return animator->data;
|
||||
animator->delete_me = EINA_TRUE;
|
||||
|
@ -111,8 +111,8 @@ ecore_animator_frametime_set(double frametime)
|
|||
animators_frametime = frametime;
|
||||
if (timer)
|
||||
{
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
}
|
||||
if (animators)
|
||||
timer = ecore_timer_add(animators_frametime, _ecore_animator, NULL);
|
||||
|
@ -143,9 +143,9 @@ ecore_animator_freeze(Ecore_Animator *animator)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return;
|
||||
}
|
||||
if (animator->delete_me) return;
|
||||
animator->suspended = EINA_TRUE;
|
||||
|
@ -164,9 +164,9 @@ ecore_animator_thaw(Ecore_Animator *animator)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR,
|
||||
"ecore_animator_del");
|
||||
return;
|
||||
}
|
||||
if (animator->delete_me) return;
|
||||
animator->suspended = EINA_FALSE;
|
||||
|
@ -177,17 +177,17 @@ _ecore_animator_shutdown(void)
|
|||
{
|
||||
if (timer)
|
||||
{
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
}
|
||||
while (animators)
|
||||
{
|
||||
Ecore_Animator *animator;
|
||||
Ecore_Animator *animator;
|
||||
|
||||
animator = animators;
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
animator = animators;
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,36 +198,36 @@ _ecore_animator(void *data __UNUSED__)
|
|||
|
||||
EINA_INLIST_FOREACH(animators, animator)
|
||||
{
|
||||
if (!animator->delete_me && !animator->suspended)
|
||||
{
|
||||
if (!animator->func(animator->data))
|
||||
{
|
||||
animator->delete_me = EINA_TRUE;
|
||||
animators_delete_me++;
|
||||
}
|
||||
}
|
||||
if (!animator->delete_me && !animator->suspended)
|
||||
{
|
||||
if (!animator->func(animator->data))
|
||||
{
|
||||
animator->delete_me = EINA_TRUE;
|
||||
animators_delete_me++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (animators_delete_me)
|
||||
{
|
||||
Ecore_Animator *l;
|
||||
for(l = animators; l;)
|
||||
{
|
||||
animator = l;
|
||||
l = (Ecore_Animator *) EINA_INLIST_GET(l)->next;
|
||||
if (animator->delete_me)
|
||||
{
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
animators_delete_me--;
|
||||
if (animators_delete_me == 0) break;
|
||||
}
|
||||
}
|
||||
Ecore_Animator *l;
|
||||
for(l = animators; l;)
|
||||
{
|
||||
animator = l;
|
||||
l = (Ecore_Animator *) EINA_INLIST_GET(l)->next;
|
||||
if (animator->delete_me)
|
||||
{
|
||||
animators = (Ecore_Animator *) eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator));
|
||||
ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE);
|
||||
free(animator);
|
||||
animators_delete_me--;
|
||||
if (animators_delete_me == 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!animators)
|
||||
{
|
||||
timer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
timer = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
|
|
|
@ -108,26 +108,26 @@ ecore_event_handler_add(int type, Ecore_Event_Handler_Cb func, const void *data)
|
|||
eh->data = (void *)data;
|
||||
if (type >= (event_handlers_num - 1))
|
||||
{
|
||||
int p_alloc_num;
|
||||
int p_alloc_num;
|
||||
|
||||
p_alloc_num = event_handlers_alloc_num;
|
||||
event_handlers_num = type + 1;
|
||||
if (event_handlers_num > event_handlers_alloc_num)
|
||||
{
|
||||
Ecore_Event_Handler **new_handlers;
|
||||
int i;
|
||||
p_alloc_num = event_handlers_alloc_num;
|
||||
event_handlers_num = type + 1;
|
||||
if (event_handlers_num > event_handlers_alloc_num)
|
||||
{
|
||||
Ecore_Event_Handler **new_handlers;
|
||||
int i;
|
||||
|
||||
event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16;
|
||||
new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
|
||||
if (!new_handlers)
|
||||
{
|
||||
free(eh);
|
||||
return NULL;
|
||||
}
|
||||
event_handlers = new_handlers;
|
||||
for (i = p_alloc_num; i < event_handlers_alloc_num; i++)
|
||||
event_handlers[i] = NULL;
|
||||
}
|
||||
event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16;
|
||||
new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *));
|
||||
if (!new_handlers)
|
||||
{
|
||||
free(eh);
|
||||
return NULL;
|
||||
}
|
||||
event_handlers = new_handlers;
|
||||
for (i = p_alloc_num; i < event_handlers_alloc_num; i++)
|
||||
event_handlers[i] = NULL;
|
||||
}
|
||||
}
|
||||
event_handlers[type] = (Ecore_Event_Handler *) eina_inlist_append(EINA_INLIST_GET(event_handlers[type]), EINA_INLIST_GET(eh));
|
||||
return eh;
|
||||
|
@ -148,9 +148,9 @@ ecore_event_handler_del(Ecore_Event_Handler *event_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
|
||||
"ecore_event_handler_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
|
||||
"ecore_event_handler_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL);
|
||||
event_handler->delete_me = 1;
|
||||
|
@ -208,8 +208,8 @@ ecore_event_del(Ecore_Event *event)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(event->delete_me, NULL);
|
||||
event->delete_me = 1;
|
||||
|
@ -284,8 +284,8 @@ ecore_event_filter_del(Ecore_Event_Filter *ef)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(ef->delete_me, NULL);
|
||||
ef->delete_me = 1;
|
||||
|
@ -344,12 +344,12 @@ _ecore_event_shutdown(void)
|
|||
event_current = NULL;
|
||||
for (i = 0; i < event_handlers_num; i++)
|
||||
{
|
||||
while ((eh = event_handlers[i]))
|
||||
{
|
||||
event_handlers[i] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
if (!eh->delete_me) free(eh);
|
||||
}
|
||||
while ((eh = event_handlers[i]))
|
||||
{
|
||||
event_handlers[i] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i]));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
if (!eh->delete_me) free(eh);
|
||||
}
|
||||
}
|
||||
EINA_LIST_FREE(event_handlers_delete_list, eh)
|
||||
free(eh);
|
||||
|
@ -359,9 +359,9 @@ _ecore_event_shutdown(void)
|
|||
event_handlers_alloc_num = 0;
|
||||
while ((ef = event_filters))
|
||||
{
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
event_filters_delete_me = 0;
|
||||
event_filter_current = NULL;
|
||||
|
@ -424,10 +424,10 @@ _ecore_event_purge_deleted(void)
|
|||
inpurge++;
|
||||
while (itr)
|
||||
{
|
||||
Ecore_Event *next = (Ecore_Event *)EINA_INLIST_GET(itr)->next;
|
||||
if ((!itr->references) && (itr->delete_me))
|
||||
_ecore_event_del(itr);
|
||||
itr = next;
|
||||
Ecore_Event *next = (Ecore_Event *)EINA_INLIST_GET(itr)->next;
|
||||
if ((!itr->references) && (itr->delete_me))
|
||||
_ecore_event_del(itr);
|
||||
itr = next;
|
||||
}
|
||||
inpurge--;
|
||||
while (purge_events)
|
||||
|
@ -444,82 +444,82 @@ _ecore_event_filters_apply()
|
|||
|
||||
if (!event_filter_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_filter_current = event_filters;
|
||||
/* regular main loop, start from head */
|
||||
event_filter_current = event_filters;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
|
||||
}
|
||||
|
||||
while (event_filter_current)
|
||||
{
|
||||
Ecore_Event_Filter *ef = event_filter_current;
|
||||
Ecore_Event_Filter *ef = event_filter_current;
|
||||
|
||||
if (!ef->delete_me)
|
||||
{
|
||||
ef->references++;
|
||||
if (!ef->delete_me)
|
||||
{
|
||||
ef->references++;
|
||||
|
||||
if (ef->func_start)
|
||||
ef->loop_data = ef->func_start(ef->data);
|
||||
if (ef->func_start)
|
||||
ef->loop_data = ef->func_start(ef->data);
|
||||
|
||||
if (!event_filter_event_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_filter_event_current = events;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
|
||||
}
|
||||
if (!event_filter_event_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_filter_event_current = events;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
|
||||
}
|
||||
|
||||
while (event_filter_event_current)
|
||||
{
|
||||
Ecore_Event *e = event_filter_event_current;
|
||||
while (event_filter_event_current)
|
||||
{
|
||||
Ecore_Event *e = event_filter_event_current;
|
||||
|
||||
if (!ef->func_filter(ef->data, ef->loop_data,
|
||||
e->type, e->event))
|
||||
{
|
||||
ecore_event_del(e);
|
||||
}
|
||||
if (!ef->func_filter(ef->data, ef->loop_data,
|
||||
e->type, e->event))
|
||||
{
|
||||
ecore_event_del(e);
|
||||
}
|
||||
|
||||
if (event_filter_event_current) /* may have changed in recursive main loops */
|
||||
event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
|
||||
}
|
||||
if (ef->func_end)
|
||||
ef->func_end(ef->data, ef->loop_data);
|
||||
if (event_filter_event_current) /* may have changed in recursive main loops */
|
||||
event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next;
|
||||
}
|
||||
if (ef->func_end)
|
||||
ef->func_end(ef->data, ef->loop_data);
|
||||
|
||||
ef->references--;
|
||||
}
|
||||
ef->references--;
|
||||
}
|
||||
|
||||
if (event_filter_current) /* may have changed in recursive main loops */
|
||||
event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
|
||||
if (event_filter_current) /* may have changed in recursive main loops */
|
||||
event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next;
|
||||
}
|
||||
if (event_filters_delete_me)
|
||||
{
|
||||
int deleted_in_use = 0;
|
||||
Ecore_Event_Filter *l;
|
||||
for (l = event_filters; l;)
|
||||
{
|
||||
Ecore_Event_Filter *ef = l;
|
||||
l = (Ecore_Event_Filter *) EINA_INLIST_GET(l)->next;
|
||||
if (ef->delete_me)
|
||||
{
|
||||
if (ef->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
int deleted_in_use = 0;
|
||||
Ecore_Event_Filter *l;
|
||||
for (l = event_filters; l;)
|
||||
{
|
||||
Ecore_Event_Filter *ef = l;
|
||||
l = (Ecore_Event_Filter *) EINA_INLIST_GET(l)->next;
|
||||
if (ef->delete_me)
|
||||
{
|
||||
if (ef->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
}
|
||||
if (!deleted_in_use)
|
||||
event_filters_delete_me = 0;
|
||||
event_filters = (Ecore_Event_Filter *) eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef));
|
||||
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
|
||||
free(ef);
|
||||
}
|
||||
}
|
||||
if (!deleted_in_use)
|
||||
event_filters_delete_me = 0;
|
||||
}
|
||||
}
|
||||
void
|
||||
|
@ -532,71 +532,71 @@ _ecore_event_call(void)
|
|||
|
||||
if (!event_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_current = events;
|
||||
event_handler_current = NULL;
|
||||
/* regular main loop, start from head */
|
||||
event_current = events;
|
||||
event_handler_current = NULL;
|
||||
}
|
||||
|
||||
while (event_current)
|
||||
{
|
||||
Ecore_Event *e = event_current;
|
||||
int handle_count = 0;
|
||||
Ecore_Event *e = event_current;
|
||||
int handle_count = 0;
|
||||
|
||||
if (e->delete_me)
|
||||
{
|
||||
event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
|
||||
continue;
|
||||
}
|
||||
if (e->delete_me)
|
||||
{
|
||||
event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
ecore_raw_event_type = e->type;
|
||||
ecore_raw_event_event = e->event;
|
||||
e->references++;
|
||||
if ((e->type >= 0) && (e->type < event_handlers_num))
|
||||
{
|
||||
if (!event_handler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_handler_current = event_handlers[e->type];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
|
||||
}
|
||||
ecore_raw_event_type = e->type;
|
||||
ecore_raw_event_event = e->event;
|
||||
e->references++;
|
||||
if ((e->type >= 0) && (e->type < event_handlers_num))
|
||||
{
|
||||
if (!event_handler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
event_handler_current = event_handlers[e->type];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
|
||||
}
|
||||
|
||||
while ((event_handler_current) && (!e->delete_me))
|
||||
{
|
||||
Ecore_Event_Handler *eh = event_handler_current;
|
||||
if (!eh->delete_me)
|
||||
{
|
||||
Eina_Bool ret;
|
||||
while ((event_handler_current) && (!e->delete_me))
|
||||
{
|
||||
Ecore_Event_Handler *eh = event_handler_current;
|
||||
if (!eh->delete_me)
|
||||
{
|
||||
Eina_Bool ret;
|
||||
|
||||
handle_count++;
|
||||
handle_count++;
|
||||
|
||||
eh->references++;
|
||||
ret = eh->func(eh->data, e->type, e->event);
|
||||
eh->references--;
|
||||
eh->references++;
|
||||
ret = eh->func(eh->data, e->type, e->event);
|
||||
eh->references--;
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
event_handler_current = NULL;
|
||||
break; /* 0 == "call no further handlers" */
|
||||
}
|
||||
}
|
||||
if (!ret)
|
||||
{
|
||||
event_handler_current = NULL;
|
||||
break; /* 0 == "call no further handlers" */
|
||||
}
|
||||
}
|
||||
|
||||
if (event_handler_current) /* may have changed in recursive main loops */
|
||||
event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
|
||||
}
|
||||
}
|
||||
/* if no handlers were set for EXIT signal - then default is */
|
||||
/* to quit the main loop */
|
||||
if ((e->type == ECORE_EVENT_SIGNAL_EXIT) && (handle_count == 0))
|
||||
ecore_main_loop_quit();
|
||||
e->references--;
|
||||
e->delete_me = 1;
|
||||
if (event_handler_current) /* may have changed in recursive main loops */
|
||||
event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next;
|
||||
}
|
||||
}
|
||||
/* if no handlers were set for EXIT signal - then default is */
|
||||
/* to quit the main loop */
|
||||
if ((e->type == ECORE_EVENT_SIGNAL_EXIT) && (handle_count == 0))
|
||||
ecore_main_loop_quit();
|
||||
e->references--;
|
||||
e->delete_me = 1;
|
||||
|
||||
if (event_current) /* may have changed in recursive main loops */
|
||||
event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
|
||||
if (event_current) /* may have changed in recursive main loops */
|
||||
event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next;
|
||||
}
|
||||
|
||||
ecore_raw_event_type = ECORE_EVENT_NONE;
|
||||
|
@ -606,13 +606,13 @@ _ecore_event_call(void)
|
|||
|
||||
EINA_LIST_FOREACH_SAFE(event_handlers_delete_list, l, l_next, eh)
|
||||
{
|
||||
if (eh->references) continue;
|
||||
if (eh->references) continue;
|
||||
|
||||
event_handlers_delete_list = eina_list_remove_list(event_handlers_delete_list, l);
|
||||
event_handlers_delete_list = eina_list_remove_list(event_handlers_delete_list, l);
|
||||
|
||||
event_handlers[eh->type] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
free(eh);
|
||||
event_handlers[eh->type] = (Ecore_Event_Handler *) eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh));
|
||||
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
|
||||
free(eh);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -26,9 +26,9 @@ _ecore_glib_fds_resize(size_t size)
|
|||
|
||||
if (!tmp)
|
||||
{
|
||||
ERR("Could not realloc from %zu to %zu buckets.",
|
||||
_ecore_glib_fds_size, size);
|
||||
return EINA_FALSE;
|
||||
ERR("Could not realloc from %zu to %zu buckets.",
|
||||
_ecore_glib_fds_size, size);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
_ecore_glib_fds = tmp;
|
||||
|
@ -51,7 +51,7 @@ _ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer)
|
|||
size_t size;
|
||||
|
||||
reqfds = g_main_context_query
|
||||
(ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size);
|
||||
(ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size);
|
||||
if (reqfds <= (int)_ecore_glib_fds_size) break;
|
||||
|
||||
size = (1 + reqfds / ECORE_GLIB_FDS_STEP) * ECORE_GLIB_FDS_STEP;
|
||||
|
@ -62,7 +62,7 @@ _ecore_glib_context_query(GMainContext *ctx, int priority, int *p_timer)
|
|||
{
|
||||
size_t size;
|
||||
|
||||
size = (1 + reqfds / ECORE_GLIB_FDS_MAX_FREE) * ECORE_GLIB_FDS_MAX_FREE;
|
||||
size = (1 + reqfds / ECORE_GLIB_FDS_MAX_FREE) * ECORE_GLIB_FDS_MAX_FREE;
|
||||
_ecore_glib_fds_resize(size);
|
||||
}
|
||||
|
||||
|
@ -78,14 +78,14 @@ _ecore_glib_context_poll_from(const GPollFD *pfds, int count, fd_set *rfds, fd_s
|
|||
for (; itr < itr_end; itr++)
|
||||
{
|
||||
if (glib_fds < itr->fd)
|
||||
glib_fds = itr->fd;
|
||||
glib_fds = itr->fd;
|
||||
|
||||
if (itr->events & G_IO_IN)
|
||||
FD_SET(itr->fd, rfds);
|
||||
FD_SET(itr->fd, rfds);
|
||||
if (itr->events & G_IO_OUT)
|
||||
FD_SET(itr->fd, wfds);
|
||||
FD_SET(itr->fd, wfds);
|
||||
if (itr->events & (G_IO_HUP | G_IO_ERR))
|
||||
FD_SET(itr->fd, efds);
|
||||
FD_SET(itr->fd, efds);
|
||||
}
|
||||
|
||||
return glib_fds + 1;
|
||||
|
@ -100,20 +100,20 @@ _ecore_glib_context_poll_to(GPollFD *pfds, int count, const fd_set *rfds, const
|
|||
{
|
||||
itr->revents = 0;
|
||||
if (FD_ISSET(itr->fd, rfds))
|
||||
{
|
||||
itr->revents |= G_IO_IN;
|
||||
ready--;
|
||||
}
|
||||
{
|
||||
itr->revents |= G_IO_IN;
|
||||
ready--;
|
||||
}
|
||||
if (FD_ISSET(itr->fd, wfds))
|
||||
{
|
||||
itr->revents |= G_IO_OUT;
|
||||
ready--;
|
||||
}
|
||||
{
|
||||
itr->revents |= G_IO_OUT;
|
||||
ready--;
|
||||
}
|
||||
if (FD_ISSET(itr->fd, efds))
|
||||
{
|
||||
itr->revents |= G_IO_ERR;
|
||||
ready--;
|
||||
}
|
||||
{
|
||||
itr->revents |= G_IO_ERR;
|
||||
ready--;
|
||||
}
|
||||
}
|
||||
return ready;
|
||||
}
|
||||
|
@ -172,11 +172,11 @@ _ecore_glib_select(int ecore_fds, fd_set *rfds, fd_set *wfds, fd_set *efds, stru
|
|||
g_mutex_lock(mutex);
|
||||
else
|
||||
{
|
||||
if (!_ecore_glib_cond)
|
||||
_ecore_glib_cond = g_cond_new();
|
||||
if (!_ecore_glib_cond)
|
||||
_ecore_glib_cond = g_cond_new();
|
||||
|
||||
while (!g_main_context_wait(ctx, _ecore_glib_cond, mutex))
|
||||
g_thread_yield();
|
||||
while (!g_main_context_wait(ctx, _ecore_glib_cond, mutex))
|
||||
g_thread_yield();
|
||||
}
|
||||
|
||||
ret = _ecore_glib_select__locked
|
||||
|
@ -206,15 +206,15 @@ _ecore_glib_shutdown(void)
|
|||
|
||||
if (_ecore_glib_fds)
|
||||
{
|
||||
free(_ecore_glib_fds);
|
||||
_ecore_glib_fds = NULL;
|
||||
free(_ecore_glib_fds);
|
||||
_ecore_glib_fds = NULL;
|
||||
}
|
||||
_ecore_glib_fds_size = 0;
|
||||
|
||||
if (_ecore_glib_cond)
|
||||
{
|
||||
g_cond_free(_ecore_glib_cond);
|
||||
_ecore_glib_cond = NULL;
|
||||
g_cond_free(_ecore_glib_cond);
|
||||
_ecore_glib_cond = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -81,9 +81,9 @@ ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(idle_enterer, ECORE_MAGIC_IDLE_ENTERER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER,
|
||||
"ecore_idle_enterer_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER,
|
||||
"ecore_idle_enterer_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_enterer->delete_me, NULL);
|
||||
idle_enterer->delete_me = 1;
|
||||
|
@ -97,9 +97,9 @@ _ecore_idle_enterer_shutdown(void)
|
|||
Ecore_Idle_Enterer *ie;
|
||||
while ((ie = idle_enterers))
|
||||
{
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
idle_enterers_delete_me = 0;
|
||||
idle_enterer_current = NULL;
|
||||
|
@ -110,56 +110,56 @@ _ecore_idle_enterer_call(void)
|
|||
{
|
||||
if (!idle_enterer_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
idle_enterer_current = idle_enterers;
|
||||
/* regular main loop, start from head */
|
||||
idle_enterer_current = idle_enterers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
idle_enterer_current =
|
||||
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
||||
/* recursive main loop, continue from where we were */
|
||||
idle_enterer_current =
|
||||
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
||||
}
|
||||
|
||||
while (idle_enterer_current)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = (Ecore_Idle_Enterer *)idle_enterer_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idle_enterer_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idle_enterer_current) /* may have changed in recursive main loops */
|
||||
idle_enterer_current =
|
||||
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
||||
Ecore_Idle_Enterer *ie = (Ecore_Idle_Enterer *)idle_enterer_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idle_enterer_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idle_enterer_current) /* may have changed in recursive main loops */
|
||||
idle_enterer_current =
|
||||
(Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next;
|
||||
}
|
||||
if (idle_enterers_delete_me)
|
||||
{
|
||||
Ecore_Idle_Enterer *l;
|
||||
int deleted_idler_enterers_in_use = 0;
|
||||
int deleted_idler_enterers_in_use = 0;
|
||||
|
||||
for (l = idle_enterers; l;)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = l;
|
||||
l = (Ecore_Idle_Enterer *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idler_enterers_in_use++;
|
||||
continue;
|
||||
}
|
||||
for (l = idle_enterers; l;)
|
||||
{
|
||||
Ecore_Idle_Enterer *ie = l;
|
||||
l = (Ecore_Idle_Enterer *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idler_enterers_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idler_enterers_in_use)
|
||||
idle_enterers_delete_me = 0;
|
||||
idle_enterers = (Ecore_Idle_Enterer *) eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idler_enterers_in_use)
|
||||
idle_enterers_delete_me = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -57,9 +57,9 @@ ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(idle_exiter, ECORE_MAGIC_IDLE_EXITER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(idle_exiter, ECORE_MAGIC_IDLE_EXITER,
|
||||
"ecore_idle_exiter_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(idle_exiter, ECORE_MAGIC_IDLE_EXITER,
|
||||
"ecore_idle_exiter_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL);
|
||||
idle_exiter->delete_me = 1;
|
||||
|
@ -73,9 +73,9 @@ _ecore_idle_exiter_shutdown(void)
|
|||
Ecore_Idle_Exiter *ie;
|
||||
while ((ie = idle_exiters))
|
||||
{
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
idle_exiters_delete_me = 0;
|
||||
idle_exiter_current = NULL;
|
||||
|
@ -86,57 +86,57 @@ _ecore_idle_exiter_call(void)
|
|||
{
|
||||
if (!idle_exiter_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
idle_exiter_current = idle_exiters;
|
||||
/* regular main loop, start from head */
|
||||
idle_exiter_current = idle_exiters;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
/* recursive main loop, continue from where we were */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
}
|
||||
|
||||
while (idle_exiter_current)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie = (Ecore_Idle_Exiter *)idle_exiter_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idle_exiter_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idle_exiter_current) /* may have changed in recursive main loops */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
Ecore_Idle_Exiter *ie = (Ecore_Idle_Exiter *)idle_exiter_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idle_exiter_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idle_exiter_current) /* may have changed in recursive main loops */
|
||||
idle_exiter_current =
|
||||
(Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next;
|
||||
}
|
||||
if (idle_exiters_delete_me)
|
||||
{
|
||||
Ecore_Idle_Exiter *l;
|
||||
int deleted_idler_exiters_in_use = 0;
|
||||
Ecore_Idle_Exiter *l;
|
||||
int deleted_idler_exiters_in_use = 0;
|
||||
|
||||
for (l = idle_exiters; l;)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie = l;
|
||||
for (l = idle_exiters; l;)
|
||||
{
|
||||
Ecore_Idle_Exiter *ie = l;
|
||||
|
||||
l = (Ecore_Idle_Exiter *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idler_exiters_in_use++;
|
||||
continue;
|
||||
}
|
||||
l = (Ecore_Idle_Exiter *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idler_exiters_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idler_exiters_in_use)
|
||||
idle_exiters_delete_me = 0;
|
||||
idle_exiters = (Ecore_Idle_Exiter *) eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idler_exiters_in_use)
|
||||
idle_exiters_delete_me = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,9 +65,9 @@ ecore_idler_del(Ecore_Idler *idler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(idler, ECORE_MAGIC_IDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(idler, ECORE_MAGIC_IDLER,
|
||||
"ecore_idler_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(idler, ECORE_MAGIC_IDLER,
|
||||
"ecore_idler_del");
|
||||
return NULL;
|
||||
}
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(idler->delete_me, NULL);
|
||||
idler->delete_me = 1;
|
||||
|
@ -81,9 +81,9 @@ _ecore_idler_shutdown(void)
|
|||
Ecore_Idler *ie;
|
||||
while ((ie = idlers))
|
||||
{
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
idlers_delete_me = 0;
|
||||
idler_current = NULL;
|
||||
|
@ -94,53 +94,53 @@ _ecore_idler_call(void)
|
|||
{
|
||||
if (!idler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
idler_current = idlers;
|
||||
/* regular main loop, start from head */
|
||||
idler_current = idlers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
|
||||
/* recursive main loop, continue from where we were */
|
||||
idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
|
||||
}
|
||||
|
||||
while (idler_current)
|
||||
{
|
||||
Ecore_Idler *ie = (Ecore_Idler *)idler_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idler_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idler_current) /* may have changed in recursive main loops */
|
||||
idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
|
||||
Ecore_Idler *ie = (Ecore_Idler *)idler_current;
|
||||
if (!ie->delete_me)
|
||||
{
|
||||
ie->references++;
|
||||
if (!ie->func(ie->data))
|
||||
{
|
||||
if (!ie->delete_me) ecore_idler_del(ie);
|
||||
}
|
||||
ie->references--;
|
||||
}
|
||||
if (idler_current) /* may have changed in recursive main loops */
|
||||
idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next;
|
||||
}
|
||||
if (idlers_delete_me)
|
||||
{
|
||||
Ecore_Idler *l;
|
||||
int deleted_idlers_in_use = 0;
|
||||
for (l = idlers; l;)
|
||||
{
|
||||
Ecore_Idler *ie = l;
|
||||
l = (Ecore_Idler *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idlers_in_use++;
|
||||
continue;
|
||||
}
|
||||
Ecore_Idler *l;
|
||||
int deleted_idlers_in_use = 0;
|
||||
for (l = idlers; l;)
|
||||
{
|
||||
Ecore_Idler *ie = l;
|
||||
l = (Ecore_Idler *) EINA_INLIST_GET(l)->next;
|
||||
if (ie->delete_me)
|
||||
{
|
||||
if (ie->references)
|
||||
{
|
||||
deleted_idlers_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idlers_in_use)
|
||||
idlers_delete_me = 0;
|
||||
idlers = (Ecore_Idler *) eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie));
|
||||
ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE);
|
||||
free(ie);
|
||||
}
|
||||
}
|
||||
if (!deleted_idlers_in_use)
|
||||
idlers_delete_me = 0;
|
||||
}
|
||||
if (idlers) return 1;
|
||||
return 0;
|
||||
|
|
|
@ -58,8 +58,8 @@ ecore_job_add(Ecore_Cb func, const void *data)
|
|||
job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL);
|
||||
if (!job->event)
|
||||
{
|
||||
free(job);
|
||||
return NULL;
|
||||
free(job);
|
||||
return NULL;
|
||||
}
|
||||
job->func = func;
|
||||
job->data = (void *)data;
|
||||
|
@ -79,9 +79,9 @@ ecore_job_del(Ecore_Job *job)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB,
|
||||
"ecore_job_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB,
|
||||
"ecore_job_del");
|
||||
return NULL;
|
||||
}
|
||||
data = job->data;
|
||||
ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE);
|
||||
|
|
|
@ -104,7 +104,7 @@ static void _ecore_main_loop_iterate_internal(int once_only);
|
|||
|
||||
#ifdef _WIN32
|
||||
static int _ecore_main_win32_select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
static void _ecore_main_win32_handlers_cleanup(void);
|
||||
#endif
|
||||
|
||||
|
@ -188,7 +188,7 @@ static inline void _ecore_main_fdh_epoll_del(Ecore_Fd_Handler *fdh)
|
|||
if ((epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0) &&
|
||||
(errno != EBADF))
|
||||
{
|
||||
ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno);
|
||||
ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno);
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -324,7 +324,7 @@ _ecore_main_gsource_check(GSource *source)
|
|||
in_main_loop--;
|
||||
INF("leave");
|
||||
|
||||
return TRUE; /* always dispatch */
|
||||
return TRUE; /* always dispatch */
|
||||
}
|
||||
|
||||
/* like we just came out of main_loop_select in _ecore_main_select */
|
||||
|
@ -379,9 +379,9 @@ _ecore_main_gsource_dispatch(GSource *source, GSourceFunc callback, gpointer use
|
|||
INF("work");
|
||||
_ecore_main_fd_handlers_call();
|
||||
_ecore_main_fd_handlers_buf_call();
|
||||
while (_ecore_signal_count_get()) _ecore_signal_call();
|
||||
while (_ecore_signal_count_get()) _ecore_signal_call();
|
||||
_ecore_event_call();
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
}
|
||||
|
||||
in_main_loop--;
|
||||
|
@ -613,9 +613,9 @@ ecore_main_fd_handler_add(int fd, Ecore_Fd_Handler_Flags flags, Ecore_Fd_Cb func
|
|||
fdh->flags = flags;
|
||||
if (0 > _ecore_main_fdh_epoll_add(fdh))
|
||||
{
|
||||
ERR("Failed to add epoll fd %d (errno = %d)!", fd, errno);
|
||||
free(fdh);
|
||||
return NULL;
|
||||
ERR("Failed to add epoll fd %d (errno = %d)!", fd, errno);
|
||||
free(fdh);
|
||||
return NULL;
|
||||
}
|
||||
fdh->read_active = 0;
|
||||
fdh->write_active = 0;
|
||||
|
@ -677,9 +677,9 @@ ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_del");
|
||||
return NULL;
|
||||
}
|
||||
fd_handler->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
|
@ -693,9 +693,9 @@ ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(win32_handler, ECORE_MAGIC_WIN32_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(win32_handler, ECORE_MAGIC_WIN32_HANDLER,
|
||||
"ecore_main_win32_handler_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(win32_handler, ECORE_MAGIC_WIN32_HANDLER,
|
||||
"ecore_main_win32_handler_del");
|
||||
return NULL;
|
||||
}
|
||||
win32_handler->delete_me = 1;
|
||||
win32_handlers_delete_me = 1;
|
||||
|
@ -714,9 +714,9 @@ ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, Ecore_F
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_prepare_callback_set");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_prepare_callback_set");
|
||||
return;
|
||||
}
|
||||
fd_handler->prep_func = func;
|
||||
fd_handler->prep_data = (void *) data;
|
||||
|
@ -733,9 +733,9 @@ ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_fd_get");
|
||||
return -1;
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_fd_get");
|
||||
return -1;
|
||||
}
|
||||
return fd_handler->fd;
|
||||
}
|
||||
|
@ -756,9 +756,9 @@ ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_active_get");
|
||||
return EINA_FALSE;
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_active_get");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
if ((flags & ECORE_FD_READ) && (fd_handler->read_active)) ret = EINA_TRUE;
|
||||
if ((flags & ECORE_FD_WRITE) && (fd_handler->write_active)) ret = EINA_TRUE;
|
||||
|
@ -777,9 +777,9 @@ ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, Ecore_Fd_Handler_
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_active_set");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER,
|
||||
"ecore_main_fd_handler_active_set");
|
||||
return;
|
||||
}
|
||||
fd_handler->flags = flags;
|
||||
if (0 > _ecore_main_fdh_epoll_modify(fd_handler))
|
||||
|
@ -794,19 +794,19 @@ _ecore_main_shutdown(void)
|
|||
if (in_main_loop)
|
||||
{
|
||||
ERR("\n"
|
||||
"*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
|
||||
"*** Program may crash or behave strangely now.");
|
||||
return;
|
||||
"*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n"
|
||||
"*** Program may crash or behave strangely now.");
|
||||
return;
|
||||
}
|
||||
while (fd_handlers)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh;
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
fdh = fd_handlers;
|
||||
fd_handlers = (Ecore_Fd_Handler *) eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
|
||||
EINA_INLIST_GET(fdh));
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
free(fdh);
|
||||
fdh = fd_handlers;
|
||||
fd_handlers = (Ecore_Fd_Handler *) eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
|
||||
EINA_INLIST_GET(fdh));
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
free(fdh);
|
||||
}
|
||||
fd_handlers_delete_me = 0;
|
||||
fd_handler_current = NULL;
|
||||
|
@ -814,13 +814,13 @@ _ecore_main_shutdown(void)
|
|||
#ifdef _WIN32
|
||||
while (win32_handlers)
|
||||
{
|
||||
Ecore_Win32_Handler *wh;
|
||||
Ecore_Win32_Handler *wh;
|
||||
|
||||
wh = win32_handlers;
|
||||
win32_handlers = (Ecore_Win32_Handler *) eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
|
||||
EINA_INLIST_GET(wh));
|
||||
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
|
||||
free(wh);
|
||||
wh = win32_handlers;
|
||||
win32_handlers = (Ecore_Win32_Handler *) eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
|
||||
EINA_INLIST_GET(wh));
|
||||
ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE);
|
||||
free(wh);
|
||||
}
|
||||
win32_handlers_delete_me = 0;
|
||||
win32_handler_current = NULL;
|
||||
|
@ -853,27 +853,27 @@ _ecore_main_select(double timeout)
|
|||
int ret;
|
||||
|
||||
t = NULL;
|
||||
if ((!finite(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */
|
||||
if ((!finite(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */
|
||||
{
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
t = &tv;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
t = &tv;
|
||||
}
|
||||
else if (timeout > 0.0)
|
||||
{
|
||||
int sec, usec;
|
||||
int sec, usec;
|
||||
|
||||
#ifdef FIX_HZ
|
||||
timeout += (0.5 / HZ);
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
timeout += (0.5 / HZ);
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
#else
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
sec = (int)timeout;
|
||||
usec = (int)((timeout - (double)sec) * 1000000);
|
||||
#endif
|
||||
tv.tv_sec = sec;
|
||||
tv.tv_usec = usec;
|
||||
t = &tv;
|
||||
tv.tv_sec = sec;
|
||||
tv.tv_usec = usec;
|
||||
t = &tv;
|
||||
}
|
||||
max_fd = 0;
|
||||
FD_ZERO(&rfds);
|
||||
|
@ -920,8 +920,8 @@ _ecore_main_select(double timeout)
|
|||
if (ret < 0)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
if (errno == EINTR) return -1;
|
||||
else if (errno == EBADF) _ecore_main_fd_handlers_bads_rem();
|
||||
if (errno == EINTR) return -1;
|
||||
else if (errno == EBADF) _ecore_main_fd_handlers_bads_rem();
|
||||
#endif
|
||||
}
|
||||
if (ret > 0)
|
||||
|
@ -931,7 +931,7 @@ _ecore_main_select(double timeout)
|
|||
#else /* HAVE_EPOLL */
|
||||
Ecore_Fd_Handler *fdh;
|
||||
|
||||
EINA_INLIST_FOREACH(fd_handlers, fdh)
|
||||
EINA_INLIST_FOREACH(fd_handlers, fdh)
|
||||
{
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
|
@ -944,11 +944,11 @@ _ecore_main_select(double timeout)
|
|||
}
|
||||
}
|
||||
#endif /* HAVE_EPOLL */
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
_ecore_main_fd_handlers_cleanup();
|
||||
#ifdef _WIN32
|
||||
_ecore_main_win32_handlers_cleanup();
|
||||
_ecore_main_win32_handlers_cleanup();
|
||||
#endif
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -964,34 +964,34 @@ _ecore_main_fd_handlers_bads_rem(void)
|
|||
ERR("Removing bad fds");
|
||||
for (l = EINA_INLIST_GET(fd_handlers); l; )
|
||||
{
|
||||
fdh = (Ecore_Fd_Handler *) l;
|
||||
l = l->next;
|
||||
errno = 0;
|
||||
fdh = (Ecore_Fd_Handler *) l;
|
||||
l = l->next;
|
||||
errno = 0;
|
||||
|
||||
if ((fcntl(fdh->fd, F_GETFD) < 0) && (errno == EBADF))
|
||||
{
|
||||
ERR("Found bad fd at index %d", fdh->fd);
|
||||
if (fdh->flags & ECORE_FD_ERROR)
|
||||
{
|
||||
ERR("Fd set for error! calling user");
|
||||
fdh->references++;
|
||||
if (!fdh->func(fdh->data, fdh))
|
||||
{
|
||||
ERR("Fd function err returned 0, remove it");
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
if ((fcntl(fdh->fd, F_GETFD) < 0) && (errno == EBADF))
|
||||
{
|
||||
ERR("Found bad fd at index %d", fdh->fd);
|
||||
if (fdh->flags & ECORE_FD_ERROR)
|
||||
{
|
||||
ERR("Fd set for error! calling user");
|
||||
fdh->references++;
|
||||
if (!fdh->func(fdh->data, fdh))
|
||||
{
|
||||
ERR("Fd function err returned 0, remove it");
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
found++;
|
||||
}
|
||||
fdh->references--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Problematic fd found at %d! setting it for delete", fdh->fd);
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
}
|
||||
fdh->references--;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Problematic fd found at %d! setting it for delete", fdh->fd);
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found == 0)
|
||||
{
|
||||
|
@ -1015,23 +1015,23 @@ _ecore_main_fd_handlers_cleanup(void)
|
|||
if (!fd_handlers_delete_me) return;
|
||||
for (l = EINA_INLIST_GET(fd_handlers); l; )
|
||||
{
|
||||
fdh = (Ecore_Fd_Handler *) l;
|
||||
fdh = (Ecore_Fd_Handler *) l;
|
||||
|
||||
l = l->next;
|
||||
if (fdh->delete_me)
|
||||
{
|
||||
if (fdh->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
l = l->next;
|
||||
if (fdh->delete_me)
|
||||
{
|
||||
if (fdh->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
fd_handlers = (Ecore_Fd_Handler *)
|
||||
fd_handlers = (Ecore_Fd_Handler *)
|
||||
eina_inlist_remove(EINA_INLIST_GET(fd_handlers),
|
||||
EINA_INLIST_GET(fdh));
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
free(fdh);
|
||||
}
|
||||
ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE);
|
||||
free(fdh);
|
||||
}
|
||||
}
|
||||
if (!deleted_in_use) fd_handlers_delete_me = 0;
|
||||
}
|
||||
|
@ -1052,11 +1052,11 @@ _ecore_main_win32_handlers_cleanup(void)
|
|||
l = l->next;
|
||||
if (wh->delete_me)
|
||||
{
|
||||
if (wh->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
if (wh->references)
|
||||
{
|
||||
deleted_in_use++;
|
||||
continue;
|
||||
}
|
||||
|
||||
win32_handlers = (Ecore_Win32_Handler *)
|
||||
eina_inlist_remove(EINA_INLIST_GET(win32_handlers),
|
||||
|
@ -1074,41 +1074,41 @@ _ecore_main_fd_handlers_call(void)
|
|||
{
|
||||
if (!fd_handler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
fd_handler_current = fd_handlers;
|
||||
/* regular main loop, start from head */
|
||||
fd_handler_current = fd_handlers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
fd_handler_current = (Ecore_Fd_Handler *)EINA_INLIST_GET(fd_handler_current)->next;
|
||||
/* recursive main loop, continue from where we were */
|
||||
fd_handler_current = (Ecore_Fd_Handler *)EINA_INLIST_GET(fd_handler_current)->next;
|
||||
}
|
||||
|
||||
while (fd_handler_current)
|
||||
{
|
||||
Ecore_Fd_Handler *fdh = fd_handler_current;
|
||||
Ecore_Fd_Handler *fdh = fd_handler_current;
|
||||
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
if ((fdh->read_active) ||
|
||||
(fdh->write_active) ||
|
||||
(fdh->error_active))
|
||||
{
|
||||
fdh->references++;
|
||||
if (!fdh->func(fdh->data, fdh))
|
||||
{
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
}
|
||||
fdh->references--;
|
||||
if (!fdh->delete_me)
|
||||
{
|
||||
if ((fdh->read_active) ||
|
||||
(fdh->write_active) ||
|
||||
(fdh->error_active))
|
||||
{
|
||||
fdh->references++;
|
||||
if (!fdh->func(fdh->data, fdh))
|
||||
{
|
||||
fdh->delete_me = 1;
|
||||
fd_handlers_delete_me = 1;
|
||||
}
|
||||
fdh->references--;
|
||||
|
||||
fdh->read_active = 0;
|
||||
fdh->write_active = 0;
|
||||
fdh->error_active = 0;
|
||||
}
|
||||
}
|
||||
fdh->read_active = 0;
|
||||
fdh->write_active = 0;
|
||||
fdh->error_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (fd_handler_current) /* may have changed in recursive main loops */
|
||||
fd_handler_current = (Ecore_Fd_Handler *)EINA_INLIST_GET(fd_handler_current)->next;
|
||||
if (fd_handler_current) /* may have changed in recursive main loops */
|
||||
fd_handler_current = (Ecore_Fd_Handler *)EINA_INLIST_GET(fd_handler_current)->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1156,21 +1156,21 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (_ecore_event_exist())
|
||||
{
|
||||
_ecore_idle_enterer_call();
|
||||
have_event = 1;
|
||||
_ecore_main_select(0.0);
|
||||
have_event = 1;
|
||||
_ecore_main_select(0.0);
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
_ecore_timer_enable_new();
|
||||
goto process_events;
|
||||
goto process_events;
|
||||
}
|
||||
/* call idle enterers ... */
|
||||
if (!once_only) _ecore_idle_enterer_call();
|
||||
else
|
||||
{
|
||||
have_event = have_signal = 0;
|
||||
have_event = have_signal = 0;
|
||||
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_signal || have_event)
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_signal || have_event)
|
||||
{
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
_ecore_timer_enable_new();
|
||||
|
@ -1184,26 +1184,26 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
/* if there are any - jump to processing them */
|
||||
if (_ecore_event_exist())
|
||||
{
|
||||
have_event = 1;
|
||||
_ecore_main_select(0.0);
|
||||
have_event = 1;
|
||||
_ecore_main_select(0.0);
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
_ecore_timer_enable_new();
|
||||
goto process_events;
|
||||
goto process_events;
|
||||
}
|
||||
if (once_only)
|
||||
{
|
||||
_ecore_idle_enterer_call();
|
||||
in_main_loop--;
|
||||
_ecore_idle_enterer_call();
|
||||
in_main_loop--;
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
_ecore_timer_enable_new();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if (_ecore_fps_debug)
|
||||
{
|
||||
t2 = ecore_time_get();
|
||||
if ((t1 > 0.0) && (t2 > 0.0))
|
||||
_ecore_fps_debug_runtime_add(t2 - t1);
|
||||
t2 = ecore_time_get();
|
||||
if ((t1 > 0.0) && (t2 > 0.0))
|
||||
_ecore_fps_debug_runtime_add(t2 - t1);
|
||||
}
|
||||
start_loop:
|
||||
/* any timers re-added as a result of these are allowed to go */
|
||||
|
@ -1211,62 +1211,62 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
if (do_quit)
|
||||
{
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
in_main_loop--;
|
||||
in_main_loop--;
|
||||
_ecore_timer_enable_new();
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (!_ecore_event_exist())
|
||||
{
|
||||
/* init flags */
|
||||
have_event = have_signal = 0;
|
||||
next_time = _ecore_timer_next_get();
|
||||
/* no timers */
|
||||
if (next_time < 0)
|
||||
{
|
||||
/* no idlers */
|
||||
if (!_ecore_idler_exist())
|
||||
{
|
||||
if (_ecore_main_select(-1.0) > 0) have_event = 1;
|
||||
}
|
||||
/* idlers */
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_event || have_signal) break;
|
||||
if (_ecore_timers_exists()) goto start_loop;
|
||||
if (do_quit) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* timers */
|
||||
else
|
||||
{
|
||||
/* no idlers */
|
||||
if (!_ecore_idler_exist())
|
||||
{
|
||||
if (_ecore_main_select(next_time) > 0) have_event = 1;
|
||||
}
|
||||
/* idlers */
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_event || have_signal) break;
|
||||
next_time = _ecore_timer_next_get();
|
||||
if (next_time <= 0) break;
|
||||
if (do_quit) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* init flags */
|
||||
have_event = have_signal = 0;
|
||||
next_time = _ecore_timer_next_get();
|
||||
/* no timers */
|
||||
if (next_time < 0)
|
||||
{
|
||||
/* no idlers */
|
||||
if (!_ecore_idler_exist())
|
||||
{
|
||||
if (_ecore_main_select(-1.0) > 0) have_event = 1;
|
||||
}
|
||||
/* idlers */
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_event || have_signal) break;
|
||||
if (_ecore_timers_exists()) goto start_loop;
|
||||
if (do_quit) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* timers */
|
||||
else
|
||||
{
|
||||
/* no idlers */
|
||||
if (!_ecore_idler_exist())
|
||||
{
|
||||
if (_ecore_main_select(next_time) > 0) have_event = 1;
|
||||
}
|
||||
/* idlers */
|
||||
else
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!_ecore_idler_call()) goto start_loop;
|
||||
if (_ecore_event_exist()) break;
|
||||
if (_ecore_main_select(0.0) > 0) have_event = 1;
|
||||
if (_ecore_signal_count_get() > 0) have_signal = 1;
|
||||
if (have_event || have_signal) break;
|
||||
next_time = _ecore_timer_next_get();
|
||||
if (next_time <= 0) break;
|
||||
if (do_quit) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_ecore_time_loop_time = ecore_time_get();
|
||||
}
|
||||
if (_ecore_fps_debug) t1 = ecore_time_get();
|
||||
|
@ -1292,7 +1292,7 @@ _ecore_main_loop_iterate_internal(int once_only)
|
|||
#ifdef _WIN32
|
||||
static int
|
||||
_ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *tv)
|
||||
fd_set *exceptfds, struct timeval *tv)
|
||||
{
|
||||
HANDLE objects[MAXIMUM_WAIT_OBJECTS];
|
||||
int sockets[MAXIMUM_WAIT_OBJECTS];
|
||||
|
@ -1315,19 +1315,19 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
|
||||
network_event = 0;
|
||||
if (FD_ISSET(fdh->fd, readfds))
|
||||
network_event |= FD_READ;
|
||||
network_event |= FD_READ;
|
||||
if (FD_ISSET(fdh->fd, writefds))
|
||||
network_event |= FD_WRITE;
|
||||
network_event |= FD_WRITE;
|
||||
if (FD_ISSET(fdh->fd, exceptfds))
|
||||
network_event |= FD_OOB;
|
||||
network_event |= FD_OOB;
|
||||
|
||||
if (network_event)
|
||||
{
|
||||
{
|
||||
event = WSACreateEvent();
|
||||
WSAEventSelect(fdh->fd, event, network_event);
|
||||
objects[objects_nbr] = event;
|
||||
sockets[events_nbr] = fdh->fd;
|
||||
events_nbr++;
|
||||
WSAEventSelect(fdh->fd, event, network_event);
|
||||
objects[objects_nbr] = event;
|
||||
sockets[events_nbr] = fdh->fd;
|
||||
events_nbr++;
|
||||
objects_nbr++;
|
||||
}
|
||||
}
|
||||
|
@ -1343,8 +1343,8 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
/* Empty the queue before waiting */
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
/* Wait for any message sent or posted to this queue */
|
||||
|
@ -1357,7 +1357,7 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
if (timeout == 0) return 0;
|
||||
|
||||
result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, EINA_FALSE,
|
||||
timeout, QS_ALLINPUT);
|
||||
timeout, QS_ALLINPUT);
|
||||
|
||||
FD_ZERO(readfds);
|
||||
FD_ZERO(writefds);
|
||||
|
@ -1381,10 +1381,10 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
else if (result == (WAIT_OBJECT_0 + objects_nbr))
|
||||
{
|
||||
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
{
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
||||
res = 0;
|
||||
}
|
||||
|
@ -1395,31 +1395,31 @@ _ecore_main_win32_select(int nfds __UNUSED__, fd_set *readfds, fd_set *writefds,
|
|||
WSAEnumNetworkEvents(sockets[result], objects[result], &network_event);
|
||||
|
||||
if (network_event.lNetworkEvents & FD_READ)
|
||||
FD_SET(sockets[result], readfds);
|
||||
FD_SET(sockets[result], readfds);
|
||||
if (network_event.lNetworkEvents & FD_WRITE)
|
||||
FD_SET(sockets[result], writefds);
|
||||
FD_SET(sockets[result], writefds);
|
||||
if (network_event.lNetworkEvents & FD_OOB)
|
||||
FD_SET(sockets[result], exceptfds);
|
||||
FD_SET(sockets[result], exceptfds);
|
||||
|
||||
res = 1;
|
||||
}
|
||||
else if ((result >= (WAIT_OBJECT_0 + events_nbr)) &&
|
||||
(result < (WAIT_OBJECT_0 + objects_nbr)))
|
||||
{
|
||||
if (!win32_handler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
win32_handler_current = win32_handlers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next;
|
||||
}
|
||||
if (!win32_handler_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
win32_handler_current = win32_handlers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next;
|
||||
}
|
||||
|
||||
while (win32_handler_current)
|
||||
{
|
||||
wh = win32_handler_current;
|
||||
while (win32_handler_current)
|
||||
{
|
||||
wh = win32_handler_current;
|
||||
|
||||
if (objects[result - WAIT_OBJECT_0] == wh->h)
|
||||
{
|
||||
|
|
|
@ -323,8 +323,8 @@ ecore_pipe_del(Ecore_Pipe *p)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del");
|
||||
return NULL;
|
||||
}
|
||||
if (p->fd_handler) ecore_main_fd_handler_del(p->fd_handler);
|
||||
if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read);
|
||||
|
@ -345,8 +345,8 @@ ecore_pipe_read_close(Ecore_Pipe *p)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_close");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_close");
|
||||
return;
|
||||
}
|
||||
ecore_main_fd_handler_del(p->fd_handler);
|
||||
p->fd_handler = NULL;
|
||||
|
@ -365,8 +365,8 @@ ecore_pipe_write_close(Ecore_Pipe *p)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close");
|
||||
return;
|
||||
}
|
||||
pipe_close(p->fd_write);
|
||||
p->fd_write = PIPE_FD_INVALID;
|
||||
|
@ -390,8 +390,8 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write");
|
||||
return EINA_FALSE;
|
||||
ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
if (p->fd_write == PIPE_FD_INVALID) return EINA_FALSE;
|
||||
|
@ -399,34 +399,34 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
|||
/* First write the len into the pipe */
|
||||
do
|
||||
{
|
||||
ret = pipe_write(p->fd_write, &nbytes, sizeof(nbytes));
|
||||
if (ret == sizeof(nbytes))
|
||||
{
|
||||
retry = ECORE_PIPE_WRITE_RETRY;
|
||||
break;
|
||||
}
|
||||
else if (ret > 0)
|
||||
{
|
||||
/* XXX What should we do here? */
|
||||
ERR("The length of the data was not written complete"
|
||||
" to the pipe");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EPIPE)
|
||||
{
|
||||
pipe_close(p->fd_write);
|
||||
p->fd_write = PIPE_FD_INVALID;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EINTR)
|
||||
/* try it again */
|
||||
;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while writing to the pipe the length",
|
||||
ret, errno);
|
||||
}
|
||||
ret = pipe_write(p->fd_write, &nbytes, sizeof(nbytes));
|
||||
if (ret == sizeof(nbytes))
|
||||
{
|
||||
retry = ECORE_PIPE_WRITE_RETRY;
|
||||
break;
|
||||
}
|
||||
else if (ret > 0)
|
||||
{
|
||||
/* XXX What should we do here? */
|
||||
ERR("The length of the data was not written complete"
|
||||
" to the pipe");
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EPIPE)
|
||||
{
|
||||
pipe_close(p->fd_write);
|
||||
p->fd_write = PIPE_FD_INVALID;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EINTR)
|
||||
/* try it again */
|
||||
;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while writing to the pipe the length",
|
||||
ret, errno);
|
||||
}
|
||||
}
|
||||
while (retry--);
|
||||
|
||||
|
@ -435,32 +435,32 @@ ecore_pipe_write(Ecore_Pipe *p, const void *buffer, unsigned int nbytes)
|
|||
/* and now pass the data to the pipe */
|
||||
do
|
||||
{
|
||||
ret = pipe_write(p->fd_write,
|
||||
ret = pipe_write(p->fd_write,
|
||||
((unsigned char *)buffer) + already_written,
|
||||
nbytes - already_written);
|
||||
|
||||
if (ret == (ssize_t)(nbytes - already_written))
|
||||
return EINA_TRUE;
|
||||
else if (ret >= 0)
|
||||
{
|
||||
already_written -= ret;
|
||||
continue;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EPIPE)
|
||||
{
|
||||
pipe_close(p->fd_write);
|
||||
p->fd_write = PIPE_FD_INVALID;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EINTR)
|
||||
/* try it again */
|
||||
;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while writing to the pipe the length",
|
||||
ret, errno);
|
||||
}
|
||||
if (ret == (ssize_t)(nbytes - already_written))
|
||||
return EINA_TRUE;
|
||||
else if (ret >= 0)
|
||||
{
|
||||
already_written -= ret;
|
||||
continue;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EPIPE)
|
||||
{
|
||||
pipe_close(p->fd_write);
|
||||
p->fd_write = PIPE_FD_INVALID;
|
||||
return EINA_FALSE;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && errno == EINTR)
|
||||
/* try it again */
|
||||
;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while writing to the pipe the length",
|
||||
ret, errno);
|
||||
}
|
||||
}
|
||||
while (retry--);
|
||||
|
||||
|
@ -480,46 +480,46 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
|
||||
do
|
||||
{
|
||||
ssize_t ret;
|
||||
ssize_t ret;
|
||||
|
||||
/* if we already have read some data we don't need to read the len
|
||||
* but to finish the already started job
|
||||
*/
|
||||
if (p->len == 0)
|
||||
{
|
||||
/* read the len of the passed data */
|
||||
ret = pipe_read(p->fd_read, &p->len, sizeof(p->len));
|
||||
/* if we already have read some data we don't need to read the len
|
||||
* but to finish the already started job
|
||||
*/
|
||||
if (p->len == 0)
|
||||
{
|
||||
/* read the len of the passed data */
|
||||
ret = pipe_read(p->fd_read, &p->len, sizeof(p->len));
|
||||
|
||||
/* catch the non error case first */
|
||||
if (ret == sizeof(p->len))
|
||||
;
|
||||
else if (ret > 0)
|
||||
{
|
||||
/* XXX What should we do here? */
|
||||
ERR("Only read %zd bytes from the pipe, although"
|
||||
" we need to read %zd bytes.", ret, sizeof(p->len));
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
p->handler((void *)p->data, NULL, 0);
|
||||
pipe_close(p->fd_read);
|
||||
p->fd_read = PIPE_FD_INVALID;
|
||||
p->fd_handler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
/* catch the non error case first */
|
||||
if (ret == sizeof(p->len))
|
||||
;
|
||||
else if (ret > 0)
|
||||
{
|
||||
/* XXX What should we do here? */
|
||||
ERR("Only read %zd bytes from the pipe, although"
|
||||
" we need to read %zd bytes.", ret, sizeof(p->len));
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
p->handler((void *)p->data, NULL, 0);
|
||||
pipe_close(p->fd_read);
|
||||
p->fd_read = PIPE_FD_INVALID;
|
||||
p->fd_handler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN)))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while reading from the pipe the length",
|
||||
ret, errno);
|
||||
else if ((ret == PIPE_FD_ERROR) && ((errno == EINTR) || (errno == EAGAIN)))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while reading from the pipe the length",
|
||||
ret, errno);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
}
|
||||
#else
|
||||
else /* ret == PIPE_FD_ERROR is the only other case on Windows */
|
||||
{
|
||||
else /* ret == PIPE_FD_ERROR is the only other case on Windows */
|
||||
{
|
||||
if (WSAGetLastError() != WSAEWOULDBLOCK)
|
||||
{
|
||||
p->handler((void *)p->data, NULL, 0);
|
||||
|
@ -528,51 +528,51 @@ _ecore_pipe_read(void *data, Ecore_Fd_Handler *fd_handler __UNUSED__)
|
|||
p->fd_handler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (!p->passed_data)
|
||||
p->passed_data = malloc(p->len);
|
||||
if (!p->passed_data)
|
||||
p->passed_data = malloc(p->len);
|
||||
|
||||
/* and read the passed data */
|
||||
ret = pipe_read(p->fd_read,
|
||||
/* and read the passed data */
|
||||
ret = pipe_read(p->fd_read,
|
||||
((unsigned char *)p->passed_data) + p->already_read,
|
||||
p->len - p->already_read);
|
||||
|
||||
/* catch the non error case first */
|
||||
if (ret == (ssize_t)(p->len - p->already_read))
|
||||
{
|
||||
p->handler((void *)p->data, p->passed_data, p->len);
|
||||
free(p->passed_data);
|
||||
/* reset all values to 0 */
|
||||
p->passed_data = NULL;
|
||||
p->already_read = 0;
|
||||
p->len = 0;
|
||||
}
|
||||
else if (ret >= 0)
|
||||
{
|
||||
p->already_read += ret;
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
p->handler((void *)p->data, NULL, 0);
|
||||
pipe_close(p->fd_read);
|
||||
p->fd_read = PIPE_FD_INVALID;
|
||||
p->fd_handler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
/* catch the non error case first */
|
||||
if (ret == (ssize_t)(p->len - p->already_read))
|
||||
{
|
||||
p->handler((void *)p->data, p->passed_data, p->len);
|
||||
free(p->passed_data);
|
||||
/* reset all values to 0 */
|
||||
p->passed_data = NULL;
|
||||
p->already_read = 0;
|
||||
p->len = 0;
|
||||
}
|
||||
else if (ret >= 0)
|
||||
{
|
||||
p->already_read += ret;
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
else if (ret == 0)
|
||||
{
|
||||
p->handler((void *)p->data, NULL, 0);
|
||||
pipe_close(p->fd_read);
|
||||
p->fd_read = PIPE_FD_INVALID;
|
||||
p->fd_handler = NULL;
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
#ifndef _WIN32
|
||||
else if (ret == PIPE_FD_ERROR && (errno == EINTR || errno == EAGAIN))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while reading from the pipe the data",
|
||||
ret, errno);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
else if (ret == PIPE_FD_ERROR && (errno == EINTR || errno == EAGAIN))
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
else
|
||||
{
|
||||
ERR("An unhandled error (ret: %zd errno: %d)"
|
||||
"occurred while reading from the pipe the data",
|
||||
ret, errno);
|
||||
return ECORE_CALLBACK_RENEW;
|
||||
}
|
||||
#else
|
||||
else /* ret == PIPE_FD_ERROR is the only other case on Windows */
|
||||
{
|
||||
|
|
|
@ -52,21 +52,21 @@ _ecore_poller_next_tick_eval(void)
|
|||
min_interval = -1;
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
if (pollers[i])
|
||||
{
|
||||
min_interval = i;
|
||||
break;
|
||||
}
|
||||
if (pollers[i])
|
||||
{
|
||||
min_interval = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (min_interval < 0)
|
||||
{
|
||||
/* no pollers */
|
||||
if (timer)
|
||||
{
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
}
|
||||
return;
|
||||
/* no pollers */
|
||||
if (timer)
|
||||
{
|
||||
ecore_timer_del(timer);
|
||||
timer = NULL;
|
||||
}
|
||||
return;
|
||||
}
|
||||
interval_incr = (1 << min_interval);
|
||||
interval = interval_incr * poll_interval;
|
||||
|
@ -76,28 +76,28 @@ _ecore_poller_next_tick_eval(void)
|
|||
* callback will adjust the timer interval at the end anyway */
|
||||
if (at_tick)
|
||||
{
|
||||
if (!timer)
|
||||
timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
|
||||
if (!timer)
|
||||
timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
double t;
|
||||
double t;
|
||||
|
||||
if (!timer)
|
||||
timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
|
||||
else
|
||||
{
|
||||
t = ecore_time_get();
|
||||
if (interval != poll_cur_interval)
|
||||
{
|
||||
t -= last_tick; /* time since we last ticked */
|
||||
/* delete the timer and reset it to tick off in the new
|
||||
* time interval. at the tick this will be adjusted */
|
||||
ecore_timer_del(timer);
|
||||
timer = ecore_timer_add(interval - t,
|
||||
_ecore_poller_cb_timer, NULL);
|
||||
}
|
||||
}
|
||||
if (!timer)
|
||||
timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL);
|
||||
else
|
||||
{
|
||||
t = ecore_time_get();
|
||||
if (interval != poll_cur_interval)
|
||||
{
|
||||
t -= last_tick; /* time since we last ticked */
|
||||
/* delete the timer and reset it to tick off in the new
|
||||
* time interval. at the tick this will be adjusted */
|
||||
ecore_timer_del(timer);
|
||||
timer = ecore_timer_add(interval - t,
|
||||
_ecore_poller_cb_timer, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
poll_cur_interval = interval;
|
||||
}
|
||||
|
@ -116,9 +116,9 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
* 7, 16 etc. up to 32768) */
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
poller_counters[i] += interval_incr;
|
||||
/* wrap back to 0 if we exceed out loop count for the counter */
|
||||
if (poller_counters[i] >= (1 << i)) poller_counters[i] = 0;
|
||||
poller_counters[i] += interval_incr;
|
||||
/* wrap back to 0 if we exceed out loop count for the counter */
|
||||
if (poller_counters[i] >= (1 << i)) poller_counters[i] = 0;
|
||||
}
|
||||
|
||||
just_added_poller = 0;
|
||||
|
@ -126,49 +126,49 @@ _ecore_poller_cb_timer(void *data __UNUSED__)
|
|||
poller_walking++;
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
/* if the counter is @ 0 - this means that counter "went off" this
|
||||
* tick interval, so run all pollers hooked to that counter */
|
||||
if (poller_counters[i] == 0)
|
||||
{
|
||||
EINA_INLIST_FOREACH(pollers[i], poller)
|
||||
{
|
||||
if (!poller->delete_me)
|
||||
{
|
||||
if (!poller->func(poller->data))
|
||||
{
|
||||
if (!poller->delete_me)
|
||||
{
|
||||
poller->delete_me = 1;
|
||||
poller_delete_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* if the counter is @ 0 - this means that counter "went off" this
|
||||
* tick interval, so run all pollers hooked to that counter */
|
||||
if (poller_counters[i] == 0)
|
||||
{
|
||||
EINA_INLIST_FOREACH(pollers[i], poller)
|
||||
{
|
||||
if (!poller->delete_me)
|
||||
{
|
||||
if (!poller->func(poller->data))
|
||||
{
|
||||
if (!poller->delete_me)
|
||||
{
|
||||
poller->delete_me = 1;
|
||||
poller_delete_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
poller_walking--;
|
||||
|
||||
/* handle deletes afterwards */
|
||||
if (poller_delete_count > 0)
|
||||
{
|
||||
/* FIXME: walk all pollers and remove deleted ones */
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
/* FIXME: walk all pollers and remove deleted ones */
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
for (l = pollers[i]; l;)
|
||||
{
|
||||
{
|
||||
poller = l;
|
||||
l = (Ecore_Poller *) EINA_INLIST_GET(l)->next;
|
||||
if (poller->delete_me)
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
poller_delete_count--;
|
||||
changes++;
|
||||
if (poller_delete_count <= 0) break;
|
||||
}
|
||||
}
|
||||
if (poller_delete_count <= 0) break;
|
||||
}
|
||||
l = (Ecore_Poller *) EINA_INLIST_GET(l)->next;
|
||||
if (poller->delete_me)
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller));
|
||||
free(poller);
|
||||
poller_delete_count--;
|
||||
changes++;
|
||||
if (poller_delete_count <= 0) break;
|
||||
}
|
||||
}
|
||||
if (poller_delete_count <= 0) break;
|
||||
}
|
||||
}
|
||||
/* if we deleted or added any pollers, then we need to re-evaluate our
|
||||
* minimum poll interval */
|
||||
|
@ -294,8 +294,8 @@ ecore_poller_add(Ecore_Poller_Type type __UNUSED__, int interval, Ecore_Task_Cb
|
|||
ibit = -1;
|
||||
while (interval != 0)
|
||||
{
|
||||
ibit++;
|
||||
interval >>= 1;
|
||||
ibit++;
|
||||
interval >>= 1;
|
||||
}
|
||||
/* only allow up to 32768 - i.e. ibit == 15, so limit it */
|
||||
if (ibit > 15) ibit = 15;
|
||||
|
@ -433,10 +433,10 @@ _ecore_poller_shutdown(void)
|
|||
|
||||
for (i = 0; i < 15; i++)
|
||||
{
|
||||
while ((poller = pollers[i]))
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
|
||||
free(poller);
|
||||
}
|
||||
while ((poller = pollers[i]))
|
||||
{
|
||||
pollers[i] = (Ecore_Poller *) eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i]));
|
||||
free(poller);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ extern int _ecore_log_dom ;
|
|||
# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x)))
|
||||
#endif
|
||||
|
||||
#define EVAS_FRAME_QUEUING 1 /* for test */
|
||||
#define EVAS_FRAME_QUEUING 1 /* for test */
|
||||
|
||||
#define READBUFSIZ 65536
|
||||
|
||||
|
@ -100,18 +100,18 @@ EAPI void ecore_print_warning(const char *function, const char *sparam);
|
|||
#undef CHECK_PARAM_POINTER_RETURN
|
||||
#define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \
|
||||
if (!(param)) \
|
||||
{ \
|
||||
ecore_print_warning(__FUNCTION__, sparam); \
|
||||
return ret; \
|
||||
}
|
||||
{ \
|
||||
ecore_print_warning(__FUNCTION__, sparam); \
|
||||
return ret; \
|
||||
}
|
||||
|
||||
#undef CHECK_PARAM_POINTER
|
||||
#define CHECK_PARAM_POINTER(sparam, param) \
|
||||
if (!(param)) \
|
||||
{ \
|
||||
ecore_print_warning(__FUNCTION__, sparam); \
|
||||
return; \
|
||||
}
|
||||
{ \
|
||||
ecore_print_warning(__FUNCTION__, sparam); \
|
||||
return; \
|
||||
}
|
||||
|
||||
typedef unsigned int Ecore_Magic;
|
||||
|
||||
|
|
|
@ -102,23 +102,23 @@ _ecore_signal_shutdown(void)
|
|||
#ifdef SIGRTMIN
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
_ecore_signal_callback_set(SIGRTMIN + i, (Signal_Handler) SIG_DFL);
|
||||
sigrt_count[i] = 0;
|
||||
_ecore_signal_callback_set(SIGRTMIN + i, (Signal_Handler) SIG_DFL);
|
||||
sigrt_count[i] = 0;
|
||||
}
|
||||
|
||||
if (sigrt_count)
|
||||
{
|
||||
free((sig_atomic_t *) sigrt_count);
|
||||
sigrt_count = NULL;
|
||||
free((sig_atomic_t *) sigrt_count);
|
||||
sigrt_count = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXSIGQ; i++)
|
||||
{
|
||||
if (sigrt_info[i])
|
||||
{
|
||||
free((siginfo_t *) sigrt_info[i]);
|
||||
sigrt_info[i] = NULL;
|
||||
}
|
||||
if (sigrt_info[i])
|
||||
{
|
||||
free((siginfo_t *) sigrt_info[i]);
|
||||
sigrt_info[i] = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -149,8 +149,8 @@ _ecore_signal_init(void)
|
|||
|
||||
for (i = 0; i < MAXSIGQ; i++)
|
||||
{
|
||||
sigrt_info[i] = calloc(1, sizeof(siginfo_t) * num);
|
||||
assert(sigrt_info[i]);
|
||||
sigrt_info[i] = calloc(1, sizeof(siginfo_t) * num);
|
||||
assert(sigrt_info[i]);
|
||||
}
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
|
@ -194,220 +194,220 @@ _ecore_signal_call(void)
|
|||
sigprocmask(SIG_BLOCK, &newset, &oldset);
|
||||
if (sigchld_count > MAXSIGQ)
|
||||
WRN("%i SIGCHLD in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigchld_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigchld_count, MAXSIGQ);
|
||||
for (n = 0; n < sigchld_count; n++)
|
||||
{
|
||||
pid_t pid;
|
||||
int status;
|
||||
pid_t pid;
|
||||
int status;
|
||||
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
|
||||
{
|
||||
Ecore_Exe_Event_Del *e;
|
||||
|
||||
/* FIXME: If this process is set respawn, respawn with a suitable backoff
|
||||
* period for those that need too much respawning.
|
||||
*/
|
||||
e = _ecore_exe_event_del_new();
|
||||
if (e)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
e->exit_code = WEXITSTATUS(status);
|
||||
e->exited = 1;
|
||||
}
|
||||
else if (WIFSIGNALED(status))
|
||||
{
|
||||
e->exit_signal = WTERMSIG(status);
|
||||
e->signalled = 1;
|
||||
}
|
||||
e->pid = pid;
|
||||
e->exe = _ecore_exe_find(pid);
|
||||
/* FIXME: If this process is set respawn, respawn with a suitable backoff
|
||||
* period for those that need too much respawning.
|
||||
*/
|
||||
e = _ecore_exe_event_del_new();
|
||||
if (e)
|
||||
{
|
||||
if (WIFEXITED(status))
|
||||
{
|
||||
e->exit_code = WEXITSTATUS(status);
|
||||
e->exited = 1;
|
||||
}
|
||||
else if (WIFSIGNALED(status))
|
||||
{
|
||||
e->exit_signal = WTERMSIG(status);
|
||||
e->signalled = 1;
|
||||
}
|
||||
e->pid = pid;
|
||||
e->exe = _ecore_exe_find(pid);
|
||||
|
||||
if ((n < MAXSIGQ) && (sigchld_info[n].si_signo))
|
||||
e->data = sigchld_info[n]; /* No need to clone this. */
|
||||
if ((n < MAXSIGQ) && (sigchld_info[n].si_signo))
|
||||
e->data = sigchld_info[n]; /* No need to clone this. */
|
||||
|
||||
if ((e->exe) && (ecore_exe_flags_get(e->exe) & (ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR)))
|
||||
{
|
||||
/* We want to report the Last Words of the exe, so delay this event.
|
||||
* This is twice as relevant for stderr.
|
||||
* There are three possibilities here -
|
||||
* 1 There are no Last Words.
|
||||
* 2 There are Last Words, they are not ready to be read.
|
||||
* 3 There are Last Words, they are ready to be read.
|
||||
*
|
||||
* For 1 we don't want to delay, for 3 we want to delay.
|
||||
* 2 is the problem. If we check for data now and there
|
||||
* is none, then there is no way to differentiate 1 and 2.
|
||||
* If we don't delay, we may loose data, but if we do delay,
|
||||
* there may not be data and the exit event never gets sent.
|
||||
*
|
||||
* Any way you look at it, there has to be some time passed
|
||||
* before the exit event gets sent. So the strategy here is
|
||||
* to setup a timer event that will send the exit event after
|
||||
* an arbitrary, but brief, time.
|
||||
*
|
||||
* This is probably paranoid, for the less paraniod, we could
|
||||
* check to see for Last Words, and only delay if there are any.
|
||||
* This has it's own set of problems.
|
||||
*/
|
||||
/* We want to report the Last Words of the exe, so delay this event.
|
||||
* This is twice as relevant for stderr.
|
||||
* There are three possibilities here -
|
||||
* 1 There are no Last Words.
|
||||
* 2 There are Last Words, they are not ready to be read.
|
||||
* 3 There are Last Words, they are ready to be read.
|
||||
*
|
||||
* For 1 we don't want to delay, for 3 we want to delay.
|
||||
* 2 is the problem. If we check for data now and there
|
||||
* is none, then there is no way to differentiate 1 and 2.
|
||||
* If we don't delay, we may loose data, but if we do delay,
|
||||
* there may not be data and the exit event never gets sent.
|
||||
*
|
||||
* Any way you look at it, there has to be some time passed
|
||||
* before the exit event gets sent. So the strategy here is
|
||||
* to setup a timer event that will send the exit event after
|
||||
* an arbitrary, but brief, time.
|
||||
*
|
||||
* This is probably paranoid, for the less paraniod, we could
|
||||
* check to see for Last Words, and only delay if there are any.
|
||||
* This has it's own set of problems.
|
||||
*/
|
||||
Ecore_Timer *doomsday_clock;
|
||||
|
||||
doomsday_clock = _ecore_exe_doomsday_clock_get(e->exe);
|
||||
IF_FN_DEL(ecore_timer_del, doomsday_clock);
|
||||
_ecore_exe_doomsday_clock_set(e->exe, ecore_timer_add(0.1, _ecore_signal_exe_exit_delay, e));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
sig_count--;
|
||||
else
|
||||
{
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigchld_count = 0;
|
||||
|
||||
if (sigusr1_count > MAXSIGQ)
|
||||
WRN("%i SIGUSR1 in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigusr1_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigusr1_count, MAXSIGQ);
|
||||
for (n = 0; n < sigusr1_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_User *e;
|
||||
Ecore_Event_Signal_User *e;
|
||||
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 1;
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 1;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigusr1_info[n].si_signo))
|
||||
e->data = sigusr1_info[n];
|
||||
if ((n < MAXSIGQ) && (sigusr1_info[n].si_signo))
|
||||
e->data = sigusr1_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigusr1_count = 0;
|
||||
|
||||
if (sigusr2_count > MAXSIGQ)
|
||||
WRN("%i SIGUSR2 in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigusr2_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigusr2_count, MAXSIGQ);
|
||||
for (n = 0; n < sigusr2_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_User *e;
|
||||
Ecore_Event_Signal_User *e;
|
||||
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 2;
|
||||
e = _ecore_event_signal_user_new();
|
||||
if (e)
|
||||
{
|
||||
e->number = 2;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigusr2_info[n].si_signo))
|
||||
e->data = sigusr2_info[n];
|
||||
if ((n < MAXSIGQ) && (sigusr2_info[n].si_signo))
|
||||
e->data = sigusr2_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigusr2_count = 0;
|
||||
|
||||
if (sighup_count > MAXSIGQ)
|
||||
WRN("%i SIGHUP in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sighup_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sighup_count, MAXSIGQ);
|
||||
for (n = 0; n < sighup_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Hup *e;
|
||||
Ecore_Event_Signal_Hup *e;
|
||||
|
||||
e = _ecore_event_signal_hup_new();
|
||||
if (e)
|
||||
{
|
||||
if ((n < MAXSIGQ) && (sighup_info[n].si_signo))
|
||||
e->data = sighup_info[n];
|
||||
e = _ecore_event_signal_hup_new();
|
||||
if (e)
|
||||
{
|
||||
if ((n < MAXSIGQ) && (sighup_info[n].si_signo))
|
||||
e->data = sighup_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sighup_count = 0;
|
||||
|
||||
if (sigquit_count > MAXSIGQ)
|
||||
WRN("%i SIGQUIT in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigquit_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigquit_count, MAXSIGQ);
|
||||
for (n = 0; n < sigquit_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->quit = 1;
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->quit = 1;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigquit_info[n].si_signo))
|
||||
e->data = sigquit_info[n];
|
||||
if ((n < MAXSIGQ) && (sigquit_info[n].si_signo))
|
||||
e->data = sigquit_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigquit_count = 0;
|
||||
|
||||
if (sigint_count > MAXSIGQ)
|
||||
WRN("%i SIGINT in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigint_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigint_count, MAXSIGQ);
|
||||
for (n = 0; n < sigint_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->interrupt = 1;
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->interrupt = 1;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigint_info[n].si_signo))
|
||||
e->data = sigint_info[n];
|
||||
if ((n < MAXSIGQ) && (sigint_info[n].si_signo))
|
||||
e->data = sigint_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigint_count = 0;
|
||||
|
||||
if (sigterm_count > MAXSIGQ)
|
||||
WRN("%i SIGTERM in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigterm_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigterm_count, MAXSIGQ);
|
||||
for (n = 0; n < sigterm_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
Ecore_Event_Signal_Exit *e;
|
||||
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->terminate = 1;
|
||||
e = _ecore_event_signal_exit_new();
|
||||
if (e)
|
||||
{
|
||||
e->terminate = 1;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigterm_info[n].si_signo))
|
||||
e->data = sigterm_info[n];
|
||||
if ((n < MAXSIGQ) && (sigterm_info[n].si_signo))
|
||||
e->data = sigterm_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigterm_count = 0;
|
||||
|
||||
#ifdef SIGPWR
|
||||
if (sigpwr_count > MAXSIGQ)
|
||||
WRN("%i SIGPWR in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", sigpwr_count, MAXSIGQ);
|
||||
"siginfo for extra signals.", sigpwr_count, MAXSIGQ);
|
||||
for (n = 0; n < sigpwr_count; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Power *e;
|
||||
Ecore_Event_Signal_Power *e;
|
||||
|
||||
e = _ecore_event_signal_power_new();
|
||||
if (e)
|
||||
{
|
||||
if ((n < MAXSIGQ) && (sigpwr_info[n].si_signo))
|
||||
e->data = sigpwr_info[n];
|
||||
e = _ecore_event_signal_power_new();
|
||||
if (e)
|
||||
{
|
||||
if ((n < MAXSIGQ) && (sigpwr_info[n].si_signo))
|
||||
e->data = sigpwr_info[n];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigpwr_count = 0;
|
||||
#endif
|
||||
|
@ -415,25 +415,25 @@ _ecore_signal_call(void)
|
|||
#ifdef SIGRTMIN
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (sigrt_count[i] > MAXSIGQ)
|
||||
WRN("%i SIGRT%i in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", i + 1, sigrt_count[i], MAXSIGQ);
|
||||
for (n = 0; n < sigrt_count[i]; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Realtime *e;
|
||||
if (sigrt_count[i] > MAXSIGQ)
|
||||
WRN("%i SIGRT%i in queue. max queue size %i. losing "
|
||||
"siginfo for extra signals.", i + 1, sigrt_count[i], MAXSIGQ);
|
||||
for (n = 0; n < sigrt_count[i]; n++)
|
||||
{
|
||||
Ecore_Event_Signal_Realtime *e;
|
||||
|
||||
if ((e = _ecore_event_signal_realtime_new()))
|
||||
{
|
||||
e->num = i;
|
||||
if ((e = _ecore_event_signal_realtime_new()))
|
||||
{
|
||||
e->num = i;
|
||||
|
||||
if ((n < MAXSIGQ) && (sigrt_info[n][i].si_signo))
|
||||
e->data = sigrt_info[n][i];
|
||||
if ((n < MAXSIGQ) && (sigrt_info[n][i].si_signo))
|
||||
e->data = sigrt_info[n][i];
|
||||
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_REALTIME, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigrt_count[i] = 0;
|
||||
ecore_event_add(ECORE_EVENT_SIGNAL_REALTIME, e, NULL, NULL);
|
||||
}
|
||||
sig_count--;
|
||||
}
|
||||
sigrt_count[i] = 0;
|
||||
}
|
||||
#endif
|
||||
sigprocmask(SIG_SETMASK, &oldset, NULL);
|
||||
|
@ -462,10 +462,10 @@ _ecore_signal_callback_sigchld(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigchld_info[n] = *si;
|
||||
else
|
||||
sigchld_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigchld_info[n] = *si;
|
||||
else
|
||||
sigchld_info[n].si_signo = 0;
|
||||
}
|
||||
|
||||
sigchld_count++;
|
||||
|
@ -479,10 +479,10 @@ _ecore_signal_callback_sigusr1(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigusr1_info[n] = *si;
|
||||
else
|
||||
sigusr1_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigusr1_info[n] = *si;
|
||||
else
|
||||
sigusr1_info[n].si_signo = 0;
|
||||
}
|
||||
sigusr1_count++;
|
||||
sig_count++;
|
||||
|
@ -495,10 +495,10 @@ _ecore_signal_callback_sigusr2(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigusr2_info[n] = *si;
|
||||
else
|
||||
sigusr2_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigusr2_info[n] = *si;
|
||||
else
|
||||
sigusr2_info[n].si_signo = 0;
|
||||
}
|
||||
sigusr2_count++;
|
||||
sig_count++;
|
||||
|
@ -511,10 +511,10 @@ _ecore_signal_callback_sighup(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sighup_info[n] = *si;
|
||||
else
|
||||
sighup_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sighup_info[n] = *si;
|
||||
else
|
||||
sighup_info[n].si_signo = 0;
|
||||
}
|
||||
sighup_count++;
|
||||
sig_count++;
|
||||
|
@ -527,10 +527,10 @@ _ecore_signal_callback_sigquit(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigquit_info[n] = *si;
|
||||
else
|
||||
sigquit_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigquit_info[n] = *si;
|
||||
else
|
||||
sigquit_info[n].si_signo = 0;
|
||||
}
|
||||
sigquit_count++;
|
||||
sig_count++;
|
||||
|
@ -543,10 +543,10 @@ _ecore_signal_callback_sigint(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigint_info[n] = *si;
|
||||
else
|
||||
sigint_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigint_info[n] = *si;
|
||||
else
|
||||
sigint_info[n].si_signo = 0;
|
||||
}
|
||||
sigint_count++;
|
||||
sig_count++;
|
||||
|
@ -559,10 +559,10 @@ _ecore_signal_callback_sigterm(int sig __UNUSED__, siginfo_t *si, void *foo __UN
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigterm_info[n] = *si;
|
||||
else
|
||||
sigterm_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigterm_info[n] = *si;
|
||||
else
|
||||
sigterm_info[n].si_signo = 0;
|
||||
}
|
||||
sigterm_count++;
|
||||
sig_count++;
|
||||
|
@ -576,10 +576,10 @@ _ecore_signal_callback_sigpwr(int sig __UNUSED__, siginfo_t *si, void *foo __UNU
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigpwr_info[n] = *si;
|
||||
else
|
||||
sigpwr_info[n].si_signo = 0;
|
||||
if (si)
|
||||
sigpwr_info[n] = *si;
|
||||
else
|
||||
sigpwr_info[n].si_signo = 0;
|
||||
}
|
||||
sigpwr_count++;
|
||||
sig_count++;
|
||||
|
@ -594,10 +594,10 @@ _ecore_signal_callback_sigrt(int sig, siginfo_t *si, void *foo __UNUSED__)
|
|||
n = sigchld_count;
|
||||
if (n < MAXSIGQ)
|
||||
{
|
||||
if (si)
|
||||
sigrt_info[n][sig - SIGRTMIN] = *si;
|
||||
else
|
||||
sigrt_info[n][sig - SIGRTMIN].si_signo = 0;
|
||||
if (si)
|
||||
sigrt_info[n][sig - SIGRTMIN] = *si;
|
||||
else
|
||||
sigrt_info[n][sig - SIGRTMIN].si_signo = 0;
|
||||
}
|
||||
sigrt_count[sig - SIGRTMIN]++;
|
||||
sig_count++;
|
||||
|
@ -612,9 +612,9 @@ _ecore_signal_exe_exit_delay(void *data)
|
|||
e = data;
|
||||
if (e)
|
||||
{
|
||||
_ecore_exe_doomsday_clock_set(e->exe, NULL);
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
_ecore_exe_doomsday_clock_set(e->exe, NULL);
|
||||
_ecore_event_add(ECORE_EXE_EVENT_DEL, e,
|
||||
_ecore_exe_event_del_free, NULL);
|
||||
}
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
|
|
@ -192,8 +192,8 @@ _ecore_short_job(Ecore_Pipe *end_pipe)
|
|||
|
||||
pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
|
||||
|
||||
if (!work->cancel)
|
||||
work->u.short_run.func_blocking((void *) work->data);
|
||||
if (!work->cancel)
|
||||
work->u.short_run.func_blocking((void *) work->data);
|
||||
|
||||
ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ _ecore_feedback_job(Ecore_Pipe *end_pipe, pthread_t thread)
|
|||
pthread_mutex_unlock(&_ecore_pending_job_threads_mutex);
|
||||
|
||||
work->self = thread;
|
||||
if (!work->cancel)
|
||||
work->u.feedback_run.func_heavy((Ecore_Thread *) work, (void *) work->data);
|
||||
if (!work->cancel)
|
||||
work->u.feedback_run.func_heavy((Ecore_Thread *) work, (void *) work->data);
|
||||
|
||||
ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *));
|
||||
}
|
||||
|
@ -586,11 +586,11 @@ ecore_thread_check(Ecore_Thread *thread)
|
|||
* try to use one from the pool.
|
||||
*/
|
||||
EAPI Ecore_Thread *ecore_thread_feedback_run(Ecore_Thread_Heavy_Cb func_heavy,
|
||||
Ecore_Thread_Notify_Cb func_notify,
|
||||
Ecore_Cb func_end,
|
||||
Ecore_Cb func_cancel,
|
||||
const void *data,
|
||||
Eina_Bool try_no_queue)
|
||||
Ecore_Thread_Notify_Cb func_notify,
|
||||
Ecore_Cb func_end,
|
||||
Ecore_Cb func_cancel,
|
||||
const void *data,
|
||||
Eina_Bool try_no_queue)
|
||||
{
|
||||
|
||||
#ifdef EFL_HAVE_PTHREAD
|
||||
|
|
|
@ -83,8 +83,8 @@ ecore_timer_precision_set(double value)
|
|||
{
|
||||
if (value < 0.0)
|
||||
{
|
||||
ERR("Precision %f less than zero, ignored", value);
|
||||
return;
|
||||
ERR("Precision %f less than zero, ignored", value);
|
||||
return;
|
||||
}
|
||||
precision = value;
|
||||
}
|
||||
|
@ -168,22 +168,22 @@ ecore_timer_del(Ecore_Timer *timer)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_del");
|
||||
return NULL;
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_del");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (timer->frozen && !timer->references)
|
||||
{
|
||||
void *data = timer->data;
|
||||
void *data = timer->data;
|
||||
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
|
||||
if (timer->delete_me)
|
||||
timers_delete_me--;
|
||||
if (timer->delete_me)
|
||||
timers_delete_me--;
|
||||
|
||||
free(timer);
|
||||
return data;
|
||||
free(timer);
|
||||
return data;
|
||||
}
|
||||
|
||||
EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL);
|
||||
|
@ -205,9 +205,9 @@ ecore_timer_interval_set(Ecore_Timer *timer, double in)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_interval_set");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_interval_set");
|
||||
return;
|
||||
}
|
||||
timer->in = in;
|
||||
}
|
||||
|
@ -224,9 +224,9 @@ ecore_timer_interval_get(Ecore_Timer *timer)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_interval_get");
|
||||
return -1.0;
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_interval_get");
|
||||
return -1.0;
|
||||
}
|
||||
|
||||
return timer->in;
|
||||
|
@ -245,38 +245,38 @@ ecore_timer_delay(Ecore_Timer *timer, double add)
|
|||
{
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_delay");
|
||||
return;
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_delay");
|
||||
return;
|
||||
}
|
||||
|
||||
if (timer->frozen)
|
||||
{
|
||||
timer->pending += add;
|
||||
timer->pending += add;
|
||||
}
|
||||
else
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
_ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
_ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pending time regarding a timer.
|
||||
*
|
||||
* @param timer The timer to learn from.
|
||||
* @ingroup Ecore_Time_Group
|
||||
* @param timer The timer to learn from.
|
||||
* @ingroup Ecore_Time_Group
|
||||
*/
|
||||
EAPI double
|
||||
ecore_timer_pending_get(Ecore_Timer *timer)
|
||||
{
|
||||
double now;
|
||||
double now;
|
||||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_pending_get");
|
||||
return 0;
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_pending_get");
|
||||
return 0;
|
||||
}
|
||||
|
||||
now = ecore_time_get();
|
||||
|
@ -297,7 +297,7 @@ ecore_timer_freeze(Ecore_Timer *timer)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_freeze");
|
||||
return ;
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ ecore_timer_thaw(Ecore_Timer *timer)
|
|||
|
||||
if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER))
|
||||
{
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER,
|
||||
"ecore_timer_thaw");
|
||||
return ;
|
||||
}
|
||||
|
@ -345,9 +345,9 @@ _ecore_timer_shutdown(void)
|
|||
|
||||
while ((timer = timers))
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
}
|
||||
|
||||
while ((timer = suspended))
|
||||
|
@ -369,52 +369,52 @@ _ecore_timer_cleanup(void)
|
|||
if (!timers_delete_me) return;
|
||||
for (l = timers; l;)
|
||||
{
|
||||
Ecore_Timer *timer = l;
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
{
|
||||
in_use++;
|
||||
continue;
|
||||
}
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
done++;
|
||||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
{
|
||||
in_use++;
|
||||
continue;
|
||||
}
|
||||
timers = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
done++;
|
||||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
}
|
||||
for (l = suspended; l;)
|
||||
{
|
||||
Ecore_Timer *timer = l;
|
||||
Ecore_Timer *timer = l;
|
||||
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
{
|
||||
in_use++;
|
||||
continue;
|
||||
}
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
done++;
|
||||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
l = (Ecore_Timer *) EINA_INLIST_GET(l)->next;
|
||||
if (timer->delete_me)
|
||||
{
|
||||
if (timer->references)
|
||||
{
|
||||
in_use++;
|
||||
continue;
|
||||
}
|
||||
suspended = (Ecore_Timer *) eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer));
|
||||
ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE);
|
||||
free(timer);
|
||||
timers_delete_me--;
|
||||
done++;
|
||||
if (timers_delete_me == 0) return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((!in_use) && (timers_delete_me))
|
||||
{
|
||||
ERR("%d timers to delete, but they were not found!"
|
||||
"Stats: todo=%d, done=%d, pending=%d, in_use=%d. "
|
||||
"reset counter.",
|
||||
timers_delete_me, todo, done, todo - done, in_use);
|
||||
timers_delete_me = 0;
|
||||
ERR("%d timers to delete, but they were not found!"
|
||||
"Stats: todo=%d, done=%d, pending=%d, in_use=%d. "
|
||||
"reset counter.",
|
||||
timers_delete_me, todo, done, todo - done, in_use);
|
||||
timers_delete_me = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -513,52 +513,52 @@ _ecore_timer_call(double when)
|
|||
if (!timers) return 0;
|
||||
if (last_check > when)
|
||||
{
|
||||
Ecore_Timer *timer;
|
||||
/* User set time backwards */
|
||||
EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when);
|
||||
Ecore_Timer *timer;
|
||||
/* User set time backwards */
|
||||
EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when);
|
||||
}
|
||||
last_check = when;
|
||||
|
||||
if (!timer_current)
|
||||
{
|
||||
/* regular main loop, start from head */
|
||||
timer_current = timers;
|
||||
/* regular main loop, start from head */
|
||||
timer_current = timers;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* recursive main loop, continue from where we were */
|
||||
Ecore_Timer *timer_old = timer_current;
|
||||
timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
|
||||
_ecore_timer_reschedule(timer_old, when);
|
||||
/* recursive main loop, continue from where we were */
|
||||
Ecore_Timer *timer_old = timer_current;
|
||||
timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
|
||||
_ecore_timer_reschedule(timer_old, when);
|
||||
}
|
||||
|
||||
while (timer_current)
|
||||
{
|
||||
Ecore_Timer *timer = timer_current;
|
||||
Ecore_Timer *timer = timer_current;
|
||||
|
||||
if (timer->at > when)
|
||||
{
|
||||
timer_current = NULL; /* ended walk, next should restart. */
|
||||
return 0;
|
||||
}
|
||||
if (timer->at > when)
|
||||
{
|
||||
timer_current = NULL; /* ended walk, next should restart. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((timer->just_added) || (timer->delete_me))
|
||||
{
|
||||
timer_current = (Ecore_Timer*)EINA_INLIST_GET(timer_current)->next;
|
||||
continue;
|
||||
}
|
||||
if ((timer->just_added) || (timer->delete_me))
|
||||
{
|
||||
timer_current = (Ecore_Timer*)EINA_INLIST_GET(timer_current)->next;
|
||||
continue;
|
||||
}
|
||||
|
||||
timer->references++;
|
||||
if (!timer->func(timer->data))
|
||||
{
|
||||
if (!timer->delete_me) ecore_timer_del(timer);
|
||||
}
|
||||
timer->references--;
|
||||
timer->references++;
|
||||
if (!timer->func(timer->data))
|
||||
{
|
||||
if (!timer->delete_me) ecore_timer_del(timer);
|
||||
}
|
||||
timer->references--;
|
||||
|
||||
if (timer_current) /* may have changed in recursive main loops */
|
||||
timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
|
||||
if (timer_current) /* may have changed in recursive main loops */
|
||||
timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next;
|
||||
|
||||
_ecore_timer_reschedule(timer, when);
|
||||
_ecore_timer_reschedule(timer, when);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -578,14 +578,14 @@ _ecore_timer_set(Ecore_Timer *timer, double at, double in, Ecore_Task_Cb func, v
|
|||
timer->pending = 0.0;
|
||||
if (timers)
|
||||
{
|
||||
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2)
|
||||
{
|
||||
if (timer->at > t2->at)
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2)
|
||||
{
|
||||
if (timer->at > t2->at)
|
||||
{
|
||||
timers = (Ecore_Timer *) eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
timers = (Ecore_Timer *) eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue