diff --git a/legacy/ecore/src/lib/ecore/Ecore.h b/legacy/ecore/src/lib/ecore/Ecore.h index d6cd9f24f0..ef24231156 100644 --- a/legacy/ecore/src/lib/ecore/Ecore.h +++ b/legacy/ecore/src/lib/ecore/Ecore.h @@ -369,14 +369,14 @@ extern "C" { EAPI Eina_Bool ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct); EAPI void *ecore_thread_pool_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb); - EAPI const void *ecore_thread_pool_data_find(Ecore_Thread *thread, const char *key); + EAPI void *ecore_thread_pool_data_find(Ecore_Thread *thread, const char *key); EAPI Eina_Bool ecore_thread_pool_data_del(Ecore_Thread *thread, const char *key); EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct); EAPI void *ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb); - EAPI const void *ecore_thread_global_data_find(const char *key); + EAPI void *ecore_thread_global_data_find(const char *key); EAPI Eina_Bool ecore_thread_global_data_del(const char *key); - EAPI const void *ecore_thread_global_data_wait(const char *key, double seconds); + EAPI void *ecore_thread_global_data_wait(const char *key, double seconds); diff --git a/legacy/ecore/src/lib/ecore/ecore_thread.c b/legacy/ecore/src/lib/ecore/ecore_thread.c index 60cb76375c..67b636e9c6 100644 --- a/legacy/ecore/src/lib/ecore/ecore_thread.c +++ b/legacy/ecore/src/lib/ecore/ecore_thread.c @@ -843,13 +843,15 @@ ecore_thread_available_get(void) * @param thread The thread context to add to * @param key The name string to add the data with * @param value The data to add + * @param cb The callback to free the data with * @param direct If true, this will not copy the key string (like eina_hash_direct_add) * @return EINA_TRUE on success, EINA_FALSE on failure * This adds data to the thread context, allowing for subsequent users of the thread's pool * to retrieve and use it without complicated mutexing. This function can only be called by a * *_run thread INSIDE the thread and will return EINA_FALSE in any case but success. - * All data added to the thread pool must be freed in the thread's func_end/func_cancel - * functions to avoid leaks. + * All data added to the thread pool will be freed with its associated callback (if present) + * upon thread termination. If no callback is specified, it is expected that the user will free the + * data, but this is most likely not what you want. */ EAPI Eina_Bool ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct) @@ -891,12 +893,14 @@ ecore_thread_pool_data_add(Ecore_Thread *thread, const char *key, void *value, E * @param thread The thread context * @param key The name string to add the data with * @param value The data to add + * @param cb The callback to free the data with * @param direct If true, this will not copy the key string (like eina_hash_direct_add) * @return The old data associated with @p key on success if modified, NULL if added * This adds/modifies data in the thread context, adding only if modify fails. * This function can only be called by a *_run thread INSIDE the thread. - * All data added to the thread pool must be freed in the thread's func_end/func_cancel - * functions to avoid leaks. + * All data added to the thread pool will be freed with its associated callback (if present) + * upon thread termination. If no callback is specified, it is expected that the user will free the + * data, but this is most likely not what you want. */ EAPI void * ecore_thread_pool_data_set(Ecore_Thread *thread, const char *key, void *value, Eina_Free_Cb cb) @@ -941,7 +945,7 @@ ecore_thread_pool_data_set(Ecore_Thread *thread, const char *key, void *value, E * in any case but success. */ -EAPI const void * +EAPI void * ecore_thread_pool_data_find(Ecore_Thread *thread, const char *key) { Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *) thread; @@ -969,7 +973,7 @@ ecore_thread_pool_data_find(Ecore_Thread *thread, const char *key) * @return EINA_TRUE on success, EINA_FALSE on failure * This deletes the data pointer from the thread context which was previously added with @ref ecore_thread_pool_data_add * This function can only be called by a *_run thread INSIDE the thread, and will return EINA_FALSE - * in any case but success. Note that this WILL NOT free the data, it merely removes it from the thread pool. + * in any case but success. Note that this WILL free the data if a callback was specified. */ EAPI Eina_Bool ecore_thread_pool_data_del(Ecore_Thread *thread, const char *key) @@ -1000,7 +1004,8 @@ ecore_thread_pool_data_del(Ecore_Thread *thread, const char *key) * @return EINA_TRUE on success, EINA_FALSE on failure * This adds data to the global thread data, and will return EINA_FALSE in any case but success. * All data added to global can be manually freed, or a callback can be provided with @p cb which will - * be called upon ecore_thread shutting down. + * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback + * was specified for, you will most likely encounter a segv later on. */ EAPI Eina_Bool ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina_Bool direct) @@ -1047,7 +1052,8 @@ ecore_thread_global_data_add(const char *key, void *value, Eina_Free_Cb cb, Eina * associated with @p key and returning the previous data if it existed. To see if an error occurred, * one must use eina_error_get. * All data added to global can be manually freed, or a callback can be provided with @p cb which will - * be called upon ecore_thread shutting down. + * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback + * was specified for, you will most likely encounter a segv later on. */ EAPI void * ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb) @@ -1091,9 +1097,14 @@ ecore_thread_global_data_set(const char *key, void *value, Eina_Free_Cb cb) * @return The value, or NULL on error * This finds data in the global data that has been previously added with @ref ecore_thread_global_data_add * This function will return NULL in any case but success. + * All data added to global can be manually freed, or a callback can be provided with @p cb which will + * be called upon ecore_thread shutting down. Note that if you have manually freed data that a callback + * was specified for, you will most likely encounter a segv later on. + * @note Keep in mind that the data returned can be used by multiple threads at a time, so you will most likely want to mutex + * if you will be doing anything with it. */ -EAPI const void * +EAPI void * ecore_thread_global_data_find(const char *key) { Ecore_Thread_Data *ret; @@ -1151,8 +1162,10 @@ ecore_thread_global_data_del(const char *key) * This finds data in the global data that has been previously added with @ref ecore_thread_global_data_add * This function will return NULL in any case but success. * Use @p seconds to specify the amount of time to wait. Use > 0 for an actual wait time, 0 to not wait, and < 0 to wait indefinitely. + * @note Keep in mind that the data returned can be used by multiple threads at a time, so you will most likely want to mutex + * if you will be doing anything with it. */ -EAPI const void * +EAPI void * ecore_thread_global_data_wait(const char *key, double seconds) { double time = 0; diff --git a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h index f067790e44..c8f7bc5dae 100644 --- a/legacy/ecore/src/lib/ecore_con/Ecore_Con.h +++ b/legacy/ecore/src/lib/ecore_con/Ecore_Con.h @@ -142,20 +142,29 @@ typedef void (*Ecore_Con_Dns_Cb)(const char *canonname, */ typedef enum _Ecore_Con_Type { - ECORE_CON_LOCAL_USER = 0, /** Socket in ~/.ecore */ - ECORE_CON_LOCAL_SYSTEM = 1, /** Socket in /tmp */ - ECORE_CON_LOCAL_ABSTRACT = 2, /** Abstract socket */ - ECORE_CON_REMOTE_TCP = 3, /** Remote server using TCP */ - ECORE_CON_REMOTE_MCAST = 4, /** Remote multicast server */ - ECORE_CON_REMOTE_UDP = 5, /** Remote server using UDP */ - ECORE_CON_REMOTE_BROADCAST = 6, /** Remote broadcast using UDP */ + /** Socket in ~/.ecore */ + ECORE_CON_LOCAL_USER = 0, + /** Socket in /tmp */ + ECORE_CON_LOCAL_SYSTEM = 1, + /** Abstract socket */ + ECORE_CON_LOCAL_ABSTRACT = 2, + /** Remote server using TCP */ + ECORE_CON_REMOTE_TCP = 3, + /** Remote multicast server */ + ECORE_CON_REMOTE_MCAST = 4, + /** Remote server using UDP */ + ECORE_CON_REMOTE_UDP = 5, + /** Remote broadcast using UDP */ + ECORE_CON_REMOTE_BROADCAST = 6, ECORE_CON_REMOTE_NODELAY = 7, - - ECORE_CON_USE_SSL2 = (1 << 4), /** Use SSL2: UNSUPPORTED. **/ - ECORE_CON_USE_SSL3 = (1 << 5), /** Use SSL3 */ - ECORE_CON_USE_TLS = (1 << 6), /** Use TLS */ - - ECORE_CON_LOAD_CERT = (1 << 7) /** Attempt to use the previously loaded certificate */ + /** Use SSL2: UNSUPPORTED. **/ + ECORE_CON_USE_SSL2 = (1 << 4), + /** Use SSL3 */ + ECORE_CON_USE_SSL3 = (1 << 5), + /** Use TLS */ + ECORE_CON_USE_TLS = (1 << 6), + /** Attempt to use the previously loaded certificate */ + ECORE_CON_LOAD_CERT = (1 << 7) } Ecore_Con_Type; #define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2 #define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP @@ -257,9 +266,12 @@ struct _Ecore_Con_Event_Server_Del */ struct _Ecore_Con_Event_Client_Data { - Ecore_Con_Client *client; /** the client that connected */ - void *data; /** the data that the client sent */ - int size; /** the length of the data sent */ + /** the client that connected */ + Ecore_Con_Client *client; + /** the data that the client sent */ + void *data; + /** the length of the data sent */ + int size; }; /** @@ -268,9 +280,12 @@ struct _Ecore_Con_Event_Client_Data */ struct _Ecore_Con_Event_Server_Data { - Ecore_Con_Server *server; /** the server that was connected to */ - void *data; /** the data that the server sent */ - int size; /** the length of the data sent */ + /** the server that was connected to */ + Ecore_Con_Server *server; + /** the data that the server sent */ + void *data; + /** the length of the data sent */ + int size; }; /** @@ -313,15 +328,24 @@ struct _Ecore_Con_Event_Url_Progress } up; }; -EAPI extern int ECORE_CON_EVENT_CLIENT_ADD; /** A client has connected to the server */ -EAPI extern int ECORE_CON_EVENT_CLIENT_DEL; /** A client has disconnected from the server */ -EAPI extern int ECORE_CON_EVENT_SERVER_ADD; /** A server was created */ -EAPI extern int ECORE_CON_EVENT_SERVER_DEL; /** A server connection was lost */ -EAPI extern int ECORE_CON_EVENT_CLIENT_DATA; /** A client connected to the server has sent data */ -EAPI extern int ECORE_CON_EVENT_SERVER_DATA; /** A server connection object has data */ -EAPI extern int ECORE_CON_EVENT_URL_DATA; /** A URL object has data */ -EAPI extern int ECORE_CON_EVENT_URL_COMPLETE; /** A URL object has completed its transfer to and from the server and can be reused */ -EAPI extern int ECORE_CON_EVENT_URL_PROGRESS; /** A URL object has made progress in its transfer */ +/** A client has connected to the server */ +EAPI extern int ECORE_CON_EVENT_CLIENT_ADD; +/** A client has disconnected from the server */ +EAPI extern int ECORE_CON_EVENT_CLIENT_DEL; +/** A server was created */ +EAPI extern int ECORE_CON_EVENT_SERVER_ADD; +/** A server connection was lost */ +EAPI extern int ECORE_CON_EVENT_SERVER_DEL; +/** A client connected to the server has sent data */ +EAPI extern int ECORE_CON_EVENT_CLIENT_DATA; +/** A server connection object has data */ +EAPI extern int ECORE_CON_EVENT_SERVER_DATA; +/** A URL object has data */ +EAPI extern int ECORE_CON_EVENT_URL_DATA; +/** A URL object has completed its transfer to and from the server and can be reused */ +EAPI extern int ECORE_CON_EVENT_URL_COMPLETE; +/** A URL object has made progress in its transfer */ +EAPI extern int ECORE_CON_EVENT_URL_PROGRESS; /** * @} */