Grid Community Toolkit  6.2.1607800521 (tag: v6.2.20201212)
globus_callback.h
Go to the documentation of this file.
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef GLOBUS_CALLBACK_H
18 #define GLOBUS_CALLBACK_H
19 
31 #include "globus_common_include.h"
32 #include "globus_module.h"
33 #include "globus_time.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 extern
40 globus_module_descriptor_t globus_i_callback_module;
41 
54 #define GLOBUS_CALLBACK_MODULE (&globus_i_callback_module)
55 
65 #define GLOBUS_POLL_MODULE GLOBUS_CALLBACK_MODULE
66 
78 typedef enum
79 {
93 
103 
113 
121 typedef struct globus_l_callback_space_attr_s * globus_callback_space_attr_t;
122 
133 /* @{ */
134 
146 #define globus_callback_poll(a) \
147  globus_callback_space_poll((a), GLOBUS_CALLBACK_GLOBAL_SPACE)
148 
160 #define globus_poll_blocking() \
161  globus_callback_poll(&globus_i_abstime_infinity)
162 
174 #define globus_poll_nonblocking() \
175  globus_callback_poll(&globus_i_abstime_zero)
176 
188 #define globus_poll() \
189  globus_poll_nonblocking()
190 
201 #define globus_signal_poll() \
202  globus_callback_signal_poll()
203 
215 #define globus_callback_register_oneshot( \
216  callback_handle, \
217  delay_time, \
218  callback_func, \
219  callback_user_arg) \
220  globus_callback_space_register_oneshot( \
221  (callback_handle), \
222  (delay_time), \
223  (callback_func), \
224  (callback_user_arg), \
225  GLOBUS_CALLBACK_GLOBAL_SPACE)
226 
238 #define globus_callback_register_periodic( \
239  callback_handle, \
240  delay_time, \
241  period, \
242  callback_func, \
243  callback_user_arg) \
244  globus_callback_space_register_periodic( \
245  (callback_handle), \
246  (delay_time), \
247  (period), \
248  (callback_func), \
249  (callback_user_arg), \
250  GLOBUS_CALLBACK_GLOBAL_SPACE)
251 
264 #define globus_callback_register_signal_handler( \
265  signum, \
266  persist, \
267  callback_func, \
268  callback_user_arg) \
269  globus_callback_space_register_signal_handler( \
270  (signum), \
271  (persist), \
272  (callback_func), \
273  (callback_user_arg), \
274  GLOBUS_CALLBACK_GLOBAL_SPACE)
275 
276 /* @} */
277 
281 /* @{ */
282 
312 typedef
313 void
315  void * user_arg);
316 
317 /* @} */
318 
322 /* @{ */
323 
359  globus_callback_handle_t * callback_handle,
360  const globus_reltime_t * delay_time,
361  globus_callback_func_t callback_func,
362  void * callback_user_arg,
363  globus_callback_space_t space);
364 
365 /* @} */
366 
370 /* @{ */
371 
411  globus_callback_handle_t * callback_handle,
412  const globus_reltime_t * delay_time,
413  const globus_reltime_t * period,
414  globus_callback_func_t callback_func,
415  void * callback_user_arg,
416  globus_callback_space_t space);
417 
464  globus_callback_handle_t callback_handle,
465  globus_callback_func_t unregister_callback,
466  void * unreg_arg,
467  globus_bool_t * active);
468 
498  globus_callback_handle_t callback_handle,
499  const globus_reltime_t * new_delay);
500 
535  globus_callback_handle_t callback_handle,
536  const globus_reltime_t * new_period);
537 /* @} */
538 
542 /* @{ */
543 
585 void
587  const globus_abstime_t * timestop,
588  globus_callback_space_t space);
589 
608 void
610 /* @} */
611 
615 /* @{ */
616 
637  globus_reltime_t * time_left);
638 
654 
674 
675 /* @} */
676 
694 #define GLOBUS_CALLBACK_GLOBAL_SPACE -2
695 
726 typedef enum
727 {
739 
767  globus_callback_space_t * space,
768  globus_callback_space_attr_t attr);
769 
789  globus_callback_space_t space);
790 
816  globus_callback_space_t space);
817 
837  globus_callback_space_attr_t * attr);
838 
855  globus_callback_space_attr_t attr);
856 
875  globus_callback_space_attr_t attr,
876  globus_callback_space_behavior_t behavior);
877 
899  globus_callback_space_attr_t attr,
900  globus_callback_space_behavior_t * behavior);
901 
916  globus_callback_space_t * space);
917 
929 int
931  globus_callback_space_t space);
932 
946  globus_callback_space_t space);
947 
948 
963 #ifdef SIGINT
964 #define GLOBUS_SIGNAL_INTERRUPT SIGINT
965 #else
966 #define GLOBUS_SIGNAL_INTERRUPT 0
967 #endif
968 
1006  int signum,
1007  globus_bool_t persist,
1008  globus_callback_func_t callback_func,
1009  void * callback_user_arg,
1010  globus_callback_space_t space);
1011 
1038  int signum,
1039  globus_callback_func_t unregister_callback,
1040  void * unreg_arg);
1041 
1069 void
1071  void (*wakeup)(void *),
1072  void * user_arg);
1073 
1074 #ifdef __cplusplus
1075 }
1076 #endif
1077 
1078 #endif /* GLOBUS_CALLBACK_H */
globus_callback_space_behavior_t
Callback space behaviors describe how a space behaves.
Definition: globus_callback.h:726
Definition: globus_callback.h:89
globus_result_t globus_callback_space_register_oneshot(globus_callback_handle_t *callback_handle, const globus_reltime_t *delay_time, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space)
Register a oneshot some delay from now.
globus_result_t globus_callback_space_register_periodic(globus_callback_handle_t *callback_handle, const globus_reltime_t *delay_time, const globus_reltime_t *period, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space)
Register a periodic callback.
globus_result_t globus_callback_unregister_signal_handler(int signum, globus_callback_func_t unregister_callback, void *unreg_arg)
Unregister a signal handling callback.
Definition: globus_callback.h:735
globus_result_t globus_callback_adjust_period(globus_callback_handle_t callback_handle, const globus_reltime_t *new_period)
Adjust the period of a periodic callback.
Definition: globus_callback.h:85
globus_bool_t globus_callback_get_timeout(globus_reltime_t *time_left)
Get the amount of time left in a callback.
Definition: globus_callback.h:87
Definition: globus_callback.h:81
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
int globus_callback_space_get_depth(globus_callback_space_t space)
Retrieve the current nesting level of a space.
int globus_callback_handle_t
Periodic callback handle.
Definition: globus_callback.h:102
globus_result_t globus_callback_space_init(globus_callback_space_t *space, globus_callback_space_attr_t attr)
Initialize a user space.
Reference Counting Module Activation and Deactivation.
globus_result_t globus_callback_adjust_oneshot(globus_callback_handle_t callback_handle, const globus_reltime_t *new_delay)
Adjust the delay of a oneshot callback.
globus_callback_error_type_t
Error types.
Definition: globus_callback.h:78
void globus_callback_add_wakeup_handler(void(*wakeup)(void *), void *user_arg)
Register a wakeup handler with callback library.
Definition: globus_callback.h:91
globus_result_t globus_callback_unregister(globus_callback_handle_t callback_handle, globus_callback_func_t unregister_callback, void *unreg_arg, globus_bool_t *active)
Unregister a callback.
globus_result_t globus_callback_space_reference(globus_callback_space_t space)
Take a reference to a space.
globus_result_t globus_callback_space_register_signal_handler(int signum, globus_bool_t persist, globus_callback_func_t callback_func, void *callback_user_arg, globus_callback_space_t space)
Fire a callback when the specified signal is received.
globus_bool_t globus_callback_space_is_single(globus_callback_space_t space)
See if the specified space is a single threaded behavior space.
void globus_callback_space_poll(const globus_abstime_t *timestop, globus_callback_space_t space)
Poll for ready callbacks.
globus_bool_t globus_callback_has_time_expired()
See if there is remaining time in a callback.
globus_result_t globus_callback_space_attr_init(globus_callback_space_attr_t *attr)
Initialize a space attr.
Definition: globus_callback.h:731
Definition: globus_callback.h:83
Definition: globus_callback.h:737
void globus_callback_signal_poll()
Signal the poll.
globus_result_t globus_callback_space_attr_set_behavior(globus_callback_space_attr_t attr, globus_callback_space_behavior_t behavior)
Set the behavior of a space.
globus_result_t globus_callback_space_attr_destroy(globus_callback_space_attr_t attr)
Destroy a space attr.
uint32_t globus_result_t
Definition: globus_types.h:99
globus_result_t globus_callback_space_attr_get_behavior(globus_callback_space_attr_t attr, globus_callback_space_behavior_t *behavior)
Get the behavior associated with an attr.
struct globus_l_callback_space_attr_s * globus_callback_space_attr_t
Callback space attribute.
Definition: globus_callback.h:121
Time Types and Macros.
globus_result_t globus_callback_space_destroy(globus_callback_space_t space)
Destroy a reference to a user space.
globus_bool_t globus_callback_was_restarted()
See if a callback has been restarted.
void(* globus_callback_func_t)(void *user_arg)
Globus callback prototype.
Definition: globus_callback.h:314
globus_result_t globus_callback_space_get(globus_callback_space_t *space)
Retrieve the space of a currently running callback.
Include System Headers.
int globus_callback_space_t
Callback space handle.
Definition: globus_callback.h:112
Module Descriptor.
Definition: globus_module.h:71