Grid Community Toolkit  6.2.1705709074 (tag: v6.2.20240202)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_i_thread.h
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_DONT_DOCUMENT_INTERNAL
18 
24 #if !defined(GLOBUS_I_THREAD_H)
25 #define GLOBUS_I_THREAD_H 1
26 
27 /******************************************************************************
28  Include header files
29 ******************************************************************************/
30 #include "globus_common_include.h"
31 
32 #define GLOBUS_L_LIBC_MAX_ERR_SIZE 512
33 
34 #define GlobusThreadMalloc(Func, Var, Type, Size) \
35 { \
36  if ((Size) > 0) \
37  { \
38  if (((Var) = (Type) globus_malloc (Size)) == (Type) NULL) \
39  { \
40  globus_fatal(\
41  "%s: malloc of size %d failed for %s %s in file %s line %d\n",\
42  #Func, (Size), #Type, #Var, __FILE__, __LINE__); \
43  } \
44  } \
45  else \
46  { \
47  (Var) = (Type) NULL; \
48  } \
49 }
50 
51 #define GlobusThreadFree(Ptr) \
52 { \
53  if ((Ptr) != NULL) \
54  { \
55  globus_macro_free(Ptr); \
56  } \
57 }
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /*
64  * globus_i_thread_report_bad_rc()
65  */
66 void
67 globus_i_thread_report_bad_rc(int rc,
68  char *message );
69 
70 #define globus_i_thread_test_rc( a, b ) \
71  do \
72  { \
73  if( a != GLOBUS_SUCCESS && a != EINTR ) \
74  { \
75  globus_i_thread_report_bad_rc( a, b ); \
76  } \
77  else \
78  { \
79  a = GLOBUS_SUCCESS;; \
80  } \
81  } while(0)
82 
83 int globus_i_thread_ignore_sigpipe(void);
84 
85 #define MAX_ERR_SIZE 80
86 #define GLOBUS_I_THREAD_GRAN 256
87 #define GLOBUS_I_THREAD_USER_THREAD 0
88 
89 #ifndef GLOBUS_THREAD_DEFAULT_STACK_SIZE
90 #define GLOBUS_THREAD_DEFAULT_STACK_SIZE 0
91 #endif
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* GLOBUS_INCLUDE_GLOBUS_I_THREAD */
98 
99 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
Include System Headers.