![]() |
Helixis 1.0
Task Programming API
|
00001 /* 00002 ** Copyright 2009-2011, helixis.org 00003 ** All rights reserved. 00004 ** 00005 ** Redistribution and use in source and binary forms, with or without modification, are permitted provided 00006 ** that the following conditions are met: 00007 ** 00008 ** Redistributions of source code must retain the above copyright notice, this list of conditions and the 00009 ** following disclaimer. 00010 ** 00011 ** Redistributions in binary form must reproduce the above copyright notice, this list of conditions and 00012 ** the following disclaimer in the documentation and/or other materials provided with the distribution. 00013 ** 00014 ** Neither the name of the helixis.org nor the names of its contributors may be used to endorse or promote 00015 ** products derived from this software without specific prior written permission. 00016 ** 00017 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 00018 ** WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00019 ** PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 00020 ** ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00021 ** TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 00022 ** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00023 ** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00024 ** POSSIBILITY OF SUCH DAMAGE. 00025 */ 00026 00027 #ifndef __HLX_NATIVE_EVENTS_H__ 00028 # define __HLX_NATIVE_EVENTS_H__ 00029 00030 #if !defined(HLX_BUILD_WITH_PARALLEL_THREADING) 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00036 /* 00037 ** TYPES 00038 */ 00039 00040 typedef struct 00041 { 00042 unsigned long hash_code; 00043 unsigned int param_size; 00044 hlx_list callbacks; 00045 } _hlx_event_handler; 00046 00047 typedef struct 00048 { 00049 hlx_event_manager reserved; 00050 hlx_list handlers; 00051 } _hlx_event_manager; 00052 00053 typedef struct 00054 { 00055 void* user_data; 00056 hlx_task_callback callback; 00057 } _hlx_event_params; 00058 00059 typedef struct 00060 { 00061 hlx_event_user_callback func; 00062 hlx_task_func task; 00063 _hlx_event_params params; 00064 hlx_group_id group_id; 00065 } _hlx_event_callback; 00066 00067 /* 00068 ** FUNCTIONS 00069 */ 00070 00071 _hlx_event_handler* _hlx_event_handler_create(unsigned long id); 00072 hlx_event_errors _hlx_event_handler_create_by_hash(_hlx_event_manager* manager, unsigned long id, unsigned int size); 00073 void _hlx_event_handler_destroy(_hlx_event_handler* handler); 00074 hlx_event_errors _hlx_event_register_callback_with_group(_hlx_event_manager* manager, _hlx_event_handler* handler, unsigned long id, _hlx_event_callback* callback, hlx_group_id group_id); 00075 hlx_event_errors _hlx_event_unregister_callback(_hlx_event_manager* manager, unsigned long id, void* user_callback); 00076 hlx_event_errors _hlx_event_unregister_callback_through_handler(_hlx_event_handler* handler, void* user_callback); 00077 _hlx_event_handler* _hlx_event_return_handler_by_hash(_hlx_event_manager* manager, unsigned long id); 00078 _hlx_event_handler* _hlx_event_return_handler(_hlx_event_manager* manager, unsigned long id); 00079 void _hlx_event_task_callback(void* param, hlx_group_id group_id, int status); 00080 void _hlx_event_default_manager_destroy(void); 00081 void _hlx_event_delete_callback(void *data, void *state); 00082 00083 #ifdef __cplusplus 00084 } 00085 #endif 00086 00087 #endif /* HLX_BUILD_WITH_PARALLEL_THREADING */ 00088 00089 #endif /* !__HLX_NATIVE_EVENTS_H__ */ 00090 00091 /* 00092 ** END OF FILE 00093 */