| 1 | /* |
| 2 | Copyright(C) 2016 Brazil |
| 3 | |
| 4 | This library is free software; you can redistribute it and/or |
| 5 | modify it under the terms of the GNU Lesser General Public |
| 6 | License as published by the Free Software Foundation; either |
| 7 | version 2.1 of the License, or (at your option) any later version. |
| 8 | |
| 9 | This library is distributed in the hope that it will be useful, |
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | Lesser General Public License for more details. |
| 13 | |
| 14 | You should have received a copy of the GNU Lesser General Public |
| 15 | License along with this library; if not, write to the Free Software |
| 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | */ |
| 18 | |
| 19 | #include "grn_ctx.h"cxx . . $ `<file>/lib/grn_ctx.h`/ |
| 20 | #include "grn_request_timer.h"cxx . . $ `<file>/lib/grn_request_timer.h`/ |
| 21 | |
| 22 | static grn_request_timercxx . . $ grn_request_timer# grn_current_request_timercxx . . $ grn_current_request_timer. = { 0 }; |
| 23 | static double grn_request_timer_default_timeoutcxx . . $ grn_request_timer_default_timeout. = 0.0; |
| 24 | |
| 25 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! |
| 26 | grn_request_timer_initcxx . . $ grn_request_timer_init(c9857a73d68e59ba).(void) |
| 27 | { |
| 28 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 29 | } |
| 30 | |
| 31 | void * |
| 32 | grn_request_timer_registercxx . . $ grn_request_timer_register(952ac9b02f270c1d).(const char *request_id, |
| 33 | unsigned int request_id_size, |
| 34 | double timeout) |
| 35 | { |
| 36 | void *timer_id = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 37 | |
| 38 | if (grn_current_request_timercxx . . $ grn_current_request_timer..register_funccxx . . $ _grn_request_timer#register_func.) { |
| 39 | void *user_data = grn_current_request_timercxx . . $ grn_current_request_timer..user_datacxx . . $ _grn_request_timer#user_data.; |
| 40 | timer_id = grn_current_request_timercxx . . $ grn_current_request_timer..register_funccxx . . $ _grn_request_timer#register_func.(request_id, |
| 41 | request_id_size, |
| 42 | timeout, |
| 43 | user_data); |
| 44 | } |
| 45 | |
| 46 | return timer_id; |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | grn_request_timer_unregistercxx . . $ grn_request_timer_unregister(5d22bdacc48458e8).(void *timer_id) |
| 51 | { |
| 52 | if (grn_current_request_timercxx . . $ grn_current_request_timer..unregister_funccxx . . $ _grn_request_timer#unregister_func.) { |
| 53 | void *user_data = grn_current_request_timercxx . . $ grn_current_request_timer..user_datacxx . . $ _grn_request_timer#user_data.; |
| 54 | grn_current_request_timercxx . . $ grn_current_request_timer..unregister_funccxx . . $ _grn_request_timer#unregister_func.(timer_id, user_data); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | void |
| 59 | grn_request_timer_setcxx . . $ grn_request_timer_set(fc4f5f035263babf).(grn_request_timercxx . . $ grn_request_timer# *timer) |
| 60 | { |
| 61 | if (grn_current_request_timercxx . . $ grn_current_request_timer..fin_funccxx . . $ _grn_request_timer#fin_func.) { |
| 62 | void *user_data = grn_current_request_timercxx . . $ grn_current_request_timer..user_datacxx . . $ _grn_request_timer#user_data.; |
| 63 | grn_current_request_timercxx . . $ grn_current_request_timer..fin_funccxx . . $ _grn_request_timer#fin_func.(user_data); |
| 64 | } |
| 65 | if (timer) { |
| 66 | grn_current_request_timercxx . . $ grn_current_request_timer. = *timer; |
| 67 | } else { |
| 68 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(&grn_current_request_timercxx . . $ grn_current_request_timer., 0, sizeof(grn_request_timercxx . . $ grn_request_timer#)); |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | double |
| 73 | grn_get_default_request_timeoutcxx . . $ grn_get_default_request_timeout(31fa7155c10fdd13).(void) |
| 74 | { |
| 75 | return grn_request_timer_default_timeoutcxx . . $ grn_request_timer_default_timeout.; |
| 76 | } |
| 77 | |
| 78 | void |
| 79 | grn_set_default_request_timeoutcxx . . $ grn_set_default_request_timeout(ba8836b59fb42830).(double timeout) |
| 80 | { |
| 81 | grn_request_timer_default_timeoutcxx . . $ grn_request_timer_default_timeout. = timeout; |
| 82 | } |
| 83 | |
| 84 | void |
| 85 | grn_request_timer_fincxx . . $ grn_request_timer_fin(49f6e7a06ebc5aa8).(void) |
| 86 | { |
| 87 | grn_request_timer_setcxx . . $ grn_request_timer_set(fc4f5f035263babf).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 88 | } |