globus_common  17.11
globus_i_thread.h
1 
2 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
3 
9 #if !defined(GLOBUS_I_THREAD_H)
10 #define GLOBUS_I_THREAD_H 1
11 
12 /******************************************************************************
13  Include header files
14 ******************************************************************************/
15 #include "globus_common_include.h"
16 
17 #define GLOBUS_L_LIBC_MAX_ERR_SIZE 512
18 
19 #define GlobusThreadMalloc(Func, Var, Type, Size) \
20 { \
21  if ((Size) > 0) \
22  { \
23  if (((Var) = (Type) globus_malloc (Size)) == (Type) NULL) \
24  { \
25  globus_fatal(\
26  "%s: malloc of size %d failed for %s %s in file %s line %d\n",\
27  #Func, (Size), #Type, #Var, __FILE__, __LINE__); \
28  } \
29  } \
30  else \
31  { \
32  (Var) = (Type) NULL; \
33  } \
34 }
35 
36 #define GlobusThreadFree(Ptr) \
37 { \
38  if ((Ptr) != NULL) \
39  { \
40  globus_macro_free(Ptr); \
41  } \
42 }
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 /*
49  * globus_i_thread_report_bad_rc()
50  */
51 void
52 globus_i_thread_report_bad_rc(int rc,
53  char *message );
54 
55 #define globus_i_thread_test_rc( a, b ) \
56  do \
57  { \
58  if( a != GLOBUS_SUCCESS && a != EINTR ) \
59  { \
60  globus_i_thread_report_bad_rc( a, b ); \
61  } \
62  else \
63  { \
64  a = GLOBUS_SUCCESS;; \
65  } \
66  } while(0)
67 
68 int globus_i_thread_ignore_sigpipe(void);
69 
70 #define MAX_ERR_SIZE 80
71 #define GLOBUS_I_THREAD_GRAN 256
72 #define GLOBUS_I_THREAD_USER_THREAD 0
73 
74 #ifndef GLOBUS_THREAD_DEFAULT_STACK_SIZE
75 #define GLOBUS_THREAD_DEFAULT_STACK_SIZE 0
76 #endif
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* GLOBUS_INCLUDE_GLOBUS_I_THREAD */
83 
84 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Include System Headers.