include/corelib/ncbithr_conf.hpp

Go to the documentation of this file.
00001 #ifndef CORELIB___NCBITHR_CONF__HPP
00002 #define CORELIB___NCBITHR_CONF__HPP
00003 
00004 /*  $Id: ncbithr_conf.hpp 103491 2007-05-04 17:18:18Z kazimird $
00005  * ===========================================================================
00006  *
00007  *                            PUBLIC DOMAIN NOTICE
00008  *               National Center for Biotechnology Information
00009  *
00010  *  This software/database is a "United States Government Work" under the
00011  *  terms of the United States Copyright Act.  It was written as part of
00012  *  the author's official duties as a United States Government employee and
00013  *  thus cannot be copyrighted.  This software/database is freely available
00014  *  to the public for use. The National Library of Medicine and the U.S.
00015  *  Government have not placed any restriction on its use or reproduction.
00016  *
00017  *  Although all reasonable efforts have been taken to ensure the accuracy
00018  *  and reliability of the software and data, the NLM and the U.S.
00019  *  Government do not and cannot warrant the performance or results that
00020  *  may be obtained by using this software or data. The NLM and the U.S.
00021  *  Government disclaim all warranties, express or implied, including
00022  *  warranties of performance, merchantability or fitness for any particular
00023  *  purpose.
00024  *
00025  *  Please cite the author in any work or product based on this material.
00026  *
00027  * ===========================================================================
00028  *
00029  * Author:  Eugene Vasilchenko
00030  *
00031  *
00032  */
00033 
00034 /// @file ncbithr_conf.hpp
00035 /// Multi-threading configuration.
00036 
00037 
00038 #include <corelib/ncbistd.hpp>
00039 
00040 #if defined(NCBI_WIN32_THREADS)
00041 #  include <corelib/ncbi_os_mswin.hpp>
00042 #elif defined(NCBI_POSIX_THREADS)
00043 extern "C" {
00044 #    include <pthread.h>
00045 }
00046 #    include <sys/errno.h>
00047 #endif
00048 
00049 
00050 
00051 BEGIN_NCBI_SCOPE
00052 
00053 /** @addtogroup Threads
00054  *
00055  * @{
00056  */
00057 
00058 /////////////////////////////////////////////////////////////////////////////
00059 //
00060 // DECLARATIONS of internal (platform-dependent) representations
00061 //
00062 //    TTlsKey          -- internal TLS key type
00063 //    TThreadHandle    -- platform-dependent thread handle type
00064 //    TThreadSystemID  -- platform-dependent thread ID type
00065 //
00066 //  NOTE:  all these types are intended for internal use only!
00067 //
00068 
00069 #if defined(NCBI_WIN32_THREADS)
00070 
00071 /// Define internal TLS key type.
00072 typedef DWORD  TTlsKey;
00073 
00074 /// Define platform-dependent thread handle type.
00075 typedef HANDLE TThreadHandle;
00076 
00077 /// Define platform-dependent thread ID type.
00078 typedef DWORD  TThreadSystemID;
00079 
00080 /// Define platform-dependent result wrapper.
00081 typedef DWORD  TWrapperRes;
00082 
00083 /// Define platform-dependent argument wrapper.
00084 typedef LPVOID TWrapperArg;
00085 
00086 #elif defined(NCBI_POSIX_THREADS)
00087 
00088 /// Define internal TLS key type.
00089 typedef pthread_key_t TTlsKey;
00090 
00091 /// Define platform-dependent thread handle type.
00092 typedef pthread_t     TThreadHandle;
00093 
00094 /// Define platform-dependent thread ID type.
00095 typedef pthread_t     TThreadSystemID;
00096 
00097 /// Define platform-dependent result wrapper.
00098 typedef void* TWrapperRes;
00099 
00100 /// Define platform-dependent argument wrapper.
00101 typedef void* TWrapperArg;
00102 
00103 #else
00104 
00105 // fake
00106 
00107 /// Define internal TLS key type.
00108 typedef void* TTlsKey;
00109 
00110 /// Define platform-dependent thread handle type.
00111 typedef int   TThreadHandle;
00112 
00113 /// Define platform-dependent thread ID type.
00114 typedef int   TThreadSystemID;
00115 
00116 /// Define platform-dependent result wrapper.
00117 typedef void* TWrapperRes;
00118 
00119 /// Define platform-dependent argument wrapper.
00120 typedef void* TWrapperArg;
00121 
00122 #endif
00123 
00124 END_NCBI_SCOPE
00125 
00126 
00127 /* @} */
00128 
00129 #endif
00130 
00131 

Generated on Sun Dec 6 22:01:28 2009 for NCBI C++ ToolKit by  doxygen 1.4.6
Modified on Mon Dec 07 16:20:35 2009 by modify_doxy.py rev. 173732