globus_i_thread.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
00003  * 
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  * 
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00017 #ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
00018 
00024 #if !defined(GLOBUS_I_THREAD_H)
00025 #define GLOBUS_I_THREAD_H 1
00026 
00027 /******************************************************************************
00028                              Include header files
00029 ******************************************************************************/
00030 #include "globus_common_include.h"
00031 
00032 #define GLOBUS_L_LIBC_MAX_ERR_SIZE 512
00033 
00034 #define GlobusThreadMalloc(Func, Var, Type, Size) \
00035 { \
00036     if ((Size) > 0) \
00037     { \
00038         if (((Var) = (Type) globus_malloc (Size)) == (Type) NULL) \
00039         { \
00040             globus_fatal(\
00041                 "%s: malloc of size %d failed for %s %s in file %s line %d\n",\
00042                 #Func, (Size), #Type, #Var, __FILE__, __LINE__); \
00043         } \
00044     } \
00045     else \
00046     { \
00047         (Var) = (Type) NULL; \
00048     } \
00049 }
00050 
00051 #define GlobusThreadFree(Ptr) \
00052 { \
00053     if ((Ptr) != NULL) \
00054     { \
00055         globus_macro_free(Ptr); \
00056     } \
00057 }    
00058 
00059 #ifdef __cplusplus
00060 extern "C" {
00061 #endif
00062 
00063 /*
00064  * globus_i_thread_report_bad_rc()
00065  */
00066 void
00067 globus_i_thread_report_bad_rc(int rc,
00068                               char *message );
00069 
00070 #define globus_i_thread_test_rc( a, b )                         \
00071     do                                                          \
00072     {                                                           \
00073         if( a != GLOBUS_SUCCESS && a != EINTR )                 \
00074         {                                                       \
00075             globus_i_thread_report_bad_rc( a, b );              \
00076         }                                                       \
00077         else                                                    \
00078         {                                                       \
00079             a = GLOBUS_SUCCESS;;                                \
00080         }                                                       \
00081     } while(0)
00082 
00083 int globus_i_thread_ignore_sigpipe(void);
00084 
00085 #define MAX_ERR_SIZE                    80
00086 #define GLOBUS_I_THREAD_GRAN            256
00087 #define GLOBUS_I_THREAD_USER_THREAD     0
00088 
00089 #ifndef GLOBUS_THREAD_DEFAULT_STACK_SIZE
00090 #define GLOBUS_THREAD_DEFAULT_STACK_SIZE 0
00091 #endif
00092 
00093 #ifdef __cplusplus
00094 }
00095 #endif
00096 
00097 #endif /* GLOBUS_INCLUDE_GLOBUS_I_THREAD */
00098 
00099 #endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */

Generated on 17 Mar 2017 for globus_common by  doxygen 1.4.7