Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 
309 typedef
310 void
312  void * user_arg);
313 
314 /* @} */
315 
319 /* @{ */
320 
356  globus_callback_handle_t * callback_handle,
357  const globus_reltime_t * delay_time,
358  globus_callback_func_t callback_func,
359  void * callback_user_arg,
360  globus_callback_space_t space);
361 
362 /* @} */
363 
367 /* @{ */
368 
408  globus_callback_handle_t * callback_handle,
409  const globus_reltime_t * delay_time,
410  const globus_reltime_t * period,
411  globus_callback_func_t callback_func,
412  void * callback_user_arg,
413  globus_callback_space_t space);
414 
461  globus_callback_handle_t callback_handle,
462  globus_callback_func_t unregister_callback,
463  void * unreg_arg,
464  globus_bool_t * active);
465 
495  globus_callback_handle_t callback_handle,
496  const globus_reltime_t * new_delay);
497 
532  globus_callback_handle_t callback_handle,
533  const globus_reltime_t * new_period);
534 /* @} */
535 
539 /* @{ */
540 
579 void
581  const globus_abstime_t * timestop,
582  globus_callback_space_t space);
583 
602 void
604 /* @} */
605 
609 /* @{ */
610 
631  globus_reltime_t * time_left);
632 
648 
668 
669 /* @} */
670 
688 #define GLOBUS_CALLBACK_GLOBAL_SPACE -2
689 
720 typedef enum
721 {
733 
761  globus_callback_space_t * space,
762  globus_callback_space_attr_t attr);
763 
783  globus_callback_space_t space);
784 
810  globus_callback_space_t space);
811 
831  globus_callback_space_attr_t * attr);
832 
849  globus_callback_space_attr_t attr);
850 
869  globus_callback_space_attr_t attr,
871 
893  globus_callback_space_attr_t attr,
895 
910  globus_callback_space_t * space);
911 
923 int
925  globus_callback_space_t space);
926 
940  globus_callback_space_t space);
941 
942 
957 #ifdef SIGINT
958 #define GLOBUS_SIGNAL_INTERRUPT SIGINT
959 #else
960 #define GLOBUS_SIGNAL_INTERRUPT 0
961 #endif
962 
1000  int signum,
1001  globus_bool_t persist,
1002  globus_callback_func_t callback_func,
1003  void * callback_user_arg,
1004  globus_callback_space_t space);
1005 
1032  int signum,
1033  globus_callback_func_t unregister_callback,
1034  void * unreg_arg);
1035 
1063 void
1065  void (*wakeup)(void *),
1066  void * user_arg);
1067 
1068 #ifdef __cplusplus
1069 }
1070 #endif
1071 
1072 #endif /* GLOBUS_CALLBACK_H */
globus_callback_space_behavior_t
Callback space behaviors describe how a space behaves.
Definition: globus_callback.h:720
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:729
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:725
Definition: globus_callback.h:83
Definition: globus_callback.h:731
void(* globus_callback_func_t)(void *user_arg)
Globus callback prototype.
Definition: globus_callback.h:311
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.
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