Merge branch 'master' into cache-better-locks

This commit is contained in:
Kseniia Sumarokova 2023-02-17 21:03:04 +01:00 committed by GitHub
commit 025ddba5ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
254 changed files with 188 additions and 15589 deletions

View File

@ -66,15 +66,6 @@ enum RSAPaddingMode
// Crypto_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
//
#if defined(_WIN32)
# if defined(POCO_DLL)
# if defined(Crypto_EXPORTS)
# define Crypto_API __declspec(dllexport)
# else
# define Crypto_API __declspec(dllimport)
# endif
# endif
#endif
#if !defined(Crypto_API)
@ -89,76 +80,6 @@ enum RSAPaddingMode
//
// Automatically link Crypto and OpenSSL libraries.
//
#if defined(_MSC_VER)
# if !defined(POCO_NO_AUTOMATIC_LIBS)
# if defined(POCO_INTERNAL_OPENSSL_MSVC_VER)
# if defined(POCO_EXTERNAL_OPENSSL)
# pragma message("External OpenSSL defined but internal headers used - possible mismatch!")
# endif // POCO_EXTERNAL_OPENSSL
# if !defined(_DEBUG)
# define POCO_DEBUG_SUFFIX ""
# if !defined(_DLL)
# define POCO_STATIC_SUFFIX "mt"
# else // _DLL
# define POCO_STATIC_SUFFIX ""
# endif
# else // _DEBUG
# define POCO_DEBUG_SUFFIX "d"
# if !defined(_DLL)
# define POCO_STATIC_SUFFIX "mt"
# else // _DLL
# define POCO_STATIC_SUFFIX ""
# endif
# endif
# pragma comment(lib, "libcrypto" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
# pragma comment(lib, "libssl" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
# if !defined(_WIN64) && !defined(_DLL) && (POCO_INTERNAL_OPENSSL_MSVC_VER == 120) \
&& (POCO_MSVC_VERSION < POCO_INTERNAL_OPENSSL_MSVC_VER)
# pragma comment(lib, "libPreVS2013CRT" POCO_STATIC_SUFFIX POCO_DEBUG_SUFFIX ".lib")
# endif
# if !defined(_DLL) && (POCO_MSVS_VERSION >= 2015)
# pragma comment(lib, "legacy_stdio_definitions.lib")
# pragma comment(lib, "legacy_stdio_wide_specifiers.lib")
# endif
# elif defined(POCO_EXTERNAL_OPENSSL)
# if POCO_EXTERNAL_OPENSSL == POCO_EXTERNAL_OPENSSL_SLPRO
# if defined(POCO_DLL)
# if OPENSSL_VERSION_PREREQ(1, 1)
# pragma comment(lib, "libcrypto.lib")
# pragma comment(lib, "libssl.lib")
# else
# pragma comment(lib, "libeay32.lib")
# pragma comment(lib, "ssleay32.lib")
# endif
# else
# if OPENSSL_VERSION_PREREQ(1, 1)
# if defined(_WIN64)
# pragma comment(lib, "libcrypto64" POCO_LIB_SUFFIX)
# pragma comment(lib, "libssl64" POCO_LIB_SUFFIX)
# else
# pragma comment(lib, "libcrypto32" POCO_LIB_SUFFIX)
# pragma comment(lib, "libssl32" POCO_LIB_SUFFIX)
# endif
# else
# pragma comment(lib, "libeay32" POCO_LIB_SUFFIX)
# pragma comment(lib, "ssleay32" POCO_LIB_SUFFIX)
# endif
# endif
# elif POCO_EXTERNAL_OPENSSL == POCO_EXTERNAL_OPENSSL_DEFAULT
# if OPENSSL_VERSION_PREREQ(1, 1)
# pragma comment(lib, "libcrypto.lib")
# pragma comment(lib, "libssl.lib")
# else
# pragma comment(lib, "libeay32.lib")
# pragma comment(lib, "ssleay32.lib")
# endif
# endif
# endif // POCO_INTERNAL_OPENSSL_MSVC_VER
# if !defined(Crypto_EXPORTS)
# pragma comment(lib, "PocoCrypto" POCO_LIB_SUFFIX)
# endif
# endif // POCO_NO_AUTOMATIC_LIBS
#endif
namespace Poco

View File

@ -22,36 +22,12 @@
#if OPENSSL_VERSION_NUMBER >= 0x0907000L
#include <openssl/conf.h>
#endif
#if defined(POCO_OS_FAMILY_WINDOWS)
#define POCO_STR_HELPER(x) #x
#define POCO_STR(x) POCO_STR_HELPER(x)
#if defined POCO_INTERNAL_OPENSSL_MSVC_VER
#define POCO_INTERNAL_OPENSSL_BUILD \
" (POCO internal build, MSVC version " \
POCO_STR(POCO_INTERNAL_OPENSSL_MSVC_VER) ")"
#else
#define POCO_INTERNAL_OPENSSL_BUILD ""
#endif
#pragma message (OPENSSL_VERSION_TEXT POCO_INTERNAL_OPENSSL_BUILD)
#endif
using Poco::RandomInputStream;
using Poco::Thread;
#if defined(_MSC_VER) && !defined(_DLL) && defined(POCO_INTERNAL_OPENSSL_MSVC_VER)
#if (POCO_MSVS_VERSION >= 2015)
FILE _iob[] = { *stdin, *stdout, *stderr };
extern "C" FILE * __cdecl __iob_func(void) { return _iob; }
#endif // (POCO_MSVS_VERSION >= 2015)
#if (POCO_MSVS_VERSION < 2012)
extern "C" __declspec(noreturn) void __cdecl __report_rangecheckfailure(void) { ::ExitProcess(1); }
#endif // (POCO_MSVS_VERSION < 2012)
#endif // _MSC_VER && _MT && !POCO_EXTERNAL_OPENSSL && (POCO_MSVS_VERSION < 2013)
namespace Poco {
@ -100,7 +76,6 @@ void OpenSSLInitializer::initialize()
int nMutexes = CRYPTO_num_locks();
_mutexes = new Poco::FastMutex[nMutexes];
CRYPTO_set_locking_callback(&OpenSSLInitializer::lock);
#ifndef POCO_OS_FAMILY_WINDOWS
// Not needed on Windows (see SF #110: random unhandled exceptions when linking with ssl).
// https://sourceforge.net/p/poco/bugs/110/
//
@ -109,7 +84,6 @@ void OpenSSLInitializer::initialize()
// then a default implementation is used - on Windows and BeOS this uses the system's
// default thread identifying APIs"
CRYPTO_set_id_callback(&OpenSSLInitializer::id);
#endif
CRYPTO_set_dynlock_create_callback(&OpenSSLInitializer::dynlockCreate);
CRYPTO_set_dynlock_lock_callback(&OpenSSLInitializer::dynlock);
CRYPTO_set_dynlock_destroy_callback(&OpenSSLInitializer::dynlockDestroy);
@ -124,9 +98,7 @@ void OpenSSLInitializer::uninitialize()
EVP_cleanup();
ERR_free_strings();
CRYPTO_set_locking_callback(0);
#ifndef POCO_OS_FAMILY_WINDOWS
CRYPTO_set_id_callback(0);
#endif
delete [] _mutexes;
CONF_modules_free();

View File

@ -20,10 +20,6 @@
#include "Poco/Format.h"
#include <sstream>
#include <openssl/pem.h>
#ifdef _WIN32
// fix for WIN32 header conflict
#undef X509_NAME
#endif
#include <openssl/x509v3.h>
#include <openssl/err.h>
#include <openssl/evp.h>

View File

@ -31,9 +31,6 @@
#include "Poco/Data/ODBC/TypeInfo.h"
#include "Poco/Data/ODBC/Utility.h"
#include "Poco/Exception.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -20,9 +20,6 @@
#include "Poco/Data/ODBC/EnvironmentHandle.h"
#include "Poco/Data/ODBC/ODBC.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -22,9 +22,6 @@
#include <vector>
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/Utility.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -19,9 +19,6 @@
#include "Poco/Data/ODBC/ODBC.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -23,9 +23,6 @@
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/Utility.h"
#include "Poco/Format.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -34,9 +34,6 @@
#include "Poco/Exception.h"
#include "Poco/Nullable.h"
#include "Poco/UTFString.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -23,9 +23,6 @@
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/ODBCException.h"
#include "Poco/Data/ODBC/Utility.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -21,9 +21,6 @@
#include "Poco/Foundation.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
//
@ -34,13 +31,6 @@
// ODBC_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
//
#if defined(_WIN32) && defined(POCO_DLL)
# if defined(ODBC_EXPORTS)
# define ODBC_API __declspec(dllexport)
# else
# define ODBC_API __declspec(dllimport)
# endif
#endif
#if !defined(ODBC_API)
@ -58,11 +48,6 @@
//
// Automatically link Data library.
//
#if defined(_MSC_VER)
# if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(ODBC_EXPORTS)
# pragma comment(lib, "PocoDataODBC" POCO_LIB_SUFFIX)
# endif
#endif
#endif // ODBC_ODBC_INCLUDED

View File

@ -23,9 +23,6 @@
#include "Poco/Data/ODBC/Handle.h"
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/ODBCException.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -29,9 +29,6 @@
#include "Poco/Data/StatementImpl.h"
#include "Poco/Format.h"
#include "Poco/SharedPtr.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -20,9 +20,6 @@
#include "Poco/Data/ODBC/Handle.h"
#include "Poco/Data/ODBC/ODBC.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -31,9 +31,6 @@
#include "Poco/DynamicAny.h"
#include "Poco/SharedPtr.h"
#include "Poco/UTFString.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -27,9 +27,6 @@
#include "Poco/Data/ODBC/TypeInfo.h"
#include "Poco/Mutex.h"
#include "Poco/SharedPtr.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqltypes.h>

View File

@ -23,9 +23,6 @@
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/DynamicAny.h"
#include "Poco/NamedTuple.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#include <sqlext.h>

View File

@ -22,9 +22,6 @@
#include "Poco/Buffer.h"
#include "Poco/Exception.h"
#include "Poco/UnicodeConverter.h"
#ifdef POCO_OS_FAMILY_WINDOWS
# include <windows.h>
#endif
#ifndef SQL_NOUNICODEMAP
# define SQL_NOUNICODEMAP
#endif
@ -33,10 +30,7 @@
#include <sqlucode.h>
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# define POCO_ODBC_UNICODE
# define POCO_ODBC_UNICODE_WINDOWS
#elif defined(POCO_OS_FAMILY_UNIX) && defined(UNICODE)
#if defined(POCO_OS_FAMILY_UNIX) && defined(UNICODE)
# define POCO_ODBC_UNICODE
# ifdef POCO_UNIXODBC
# define POCO_ODBC_UNICODE_UNIXODBC

View File

@ -500,18 +500,6 @@ void Binder::getColumnOrParameterSize(std::size_t pos, SQLINTEGER& size)
{
size = DEFAULT_PARAM_SIZE;
//On Linux, PostgreSQL driver segfaults on SQLGetDescField, so this is disabled for now
#ifdef POCO_OS_FAMILY_WINDOWS
SQLHDESC hIPD = 0;
if (!Utility::isError(SQLGetStmtAttr(_rStmt, SQL_ATTR_IMP_PARAM_DESC, &hIPD, SQL_IS_POINTER, 0)))
{
SQLUINTEGER sz = 0;
if (!Utility::isError(SQLGetDescField(hIPD, (SQLSMALLINT) pos + 1, SQL_DESC_LENGTH, &sz, SQL_IS_UINTEGER, 0)) &&
sz > 0)
{
size = sz;
}
}
#endif
}
if (colSize > 0 && paramSize > 0)

View File

@ -20,9 +20,6 @@
#include "Poco/Exception.h"
#ifdef POCO_OS_FAMILY_WINDOWS
#pragma warning(disable:4312)// 'type cast' : conversion from 'std::size_t' to 'SQLPOINTER' of greater size
#endif
using Poco::DataFormatException;

View File

@ -31,13 +31,6 @@
// Data_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
//
#if defined(_WIN32) && defined(POCO_DLL)
# if defined(Data_EXPORTS)
# define Data_API __declspec(dllexport)
# else
# define Data_API __declspec(dllimport)
# endif
#endif
#if !defined(Data_API)
@ -52,11 +45,6 @@
//
// Automatically link Data library.
//
#if defined(_MSC_VER)
# if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Data_EXPORTS)
# pragma comment(lib, "PocoData" POCO_LIB_SUFFIX)
# endif
#endif
#endif // Data_Data_INCLUDED

View File

@ -135,7 +135,6 @@ struct AlignedCharArrayImpl;
// MSVC requires special handling here.
# ifndef _MSC_VER
# ifdef POCO_COMPILER_CLANG
@ -179,58 +178,6 @@ POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192);
# undef POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
# endif // POCO_HAVE_ALIGNMENT
# else // _MSC_VER
// We provide special variations of this template for the most common
// alignments because __declspec(align(...)) doesn't actually work when it is
// a member of a by-value function argument in MSVC, even if the alignment
// request is something reasonably like 8-byte or 16-byte.
template <>
struct AlignedCharArrayImpl<1>
{
char aligned;
};
template <>
struct AlignedCharArrayImpl<2>
{
short aligned;
};
template <>
struct AlignedCharArrayImpl<4>
{
int aligned;
};
template <>
struct AlignedCharArrayImpl<8>
{
double aligned;
};
# define POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(x) \
template <> \
struct AlignedCharArrayImpl<x> \
{ \
__declspec(align(x)) char aligned; \
}
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(16);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(32);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(64);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(128);
# if (_MSC_VER > 1600) // MSVC 2010 complains on alignment larger than 128
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(512);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(1024);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(2048);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(4096);
POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT(8192);
# endif // _MSC_VER > 1600
// Any larger and MSVC complains.
# undef POCO_ALIGNEDCHARARRAY_TEMPLATE_ALIGNMENT
# define POCO_HAVE_ALIGNMENT
# endif // _MSC_VER
// POCO_HAVE_ALIGNMENT will be defined on the pre-C++11 platforms/compilers where
// it can be reliably determined and used. Uncomment the line below to explicitly

View File

@ -161,9 +161,6 @@ private:
// instantiation - to avoid duplicate symbols due to multiple
// instantiations in different libraries.
//
#if defined(_MSC_VER) && defined(POCO_DLL) && !defined(Foundation_EXPORTS)
template class Foundation_API BasicBufferedBidirectionalStreamBuf<char, std::char_traits<char>>;
#endif
typedef BasicBufferedBidirectionalStreamBuf<char, std::char_traits<char>> BufferedBidirectionalStreamBuf;

View File

@ -151,9 +151,6 @@ private:
// instantiation - to avoid duplicate symbols due to multiple
// instantiations in different libraries.
//
#if defined(_MSC_VER) && defined(POCO_DLL) && !defined(Foundation_EXPORTS)
template class Foundation_API BasicBufferedStreamBuf<char, std::char_traits<char>>;
#endif
typedef BasicBufferedStreamBuf<char, std::char_traits<char>> BufferedStreamBuf;

View File

@ -18,9 +18,6 @@
#include "Poco/Foundation.h"
#include "Poco/Types.h"
#if defined(_MSC_VER)
# include <stdlib.h> // builtins
#endif
namespace Poco
@ -99,11 +96,7 @@ public:
#if !defined(POCO_NO_BYTESWAP_BUILTINS)
# if defined(_MSC_VER)
# if (POCO_MSVC_VERSION > 71)
# define POCO_HAVE_MSC_BYTESWAP 1
# endif
# elif defined(__clang__)
# if defined(__clang__)
# if __has_builtin(__builtin_bswap32)
# define POCO_HAVE_GCC_BYTESWAP 1
# endif

View File

@ -23,11 +23,7 @@
#include "Poco/Manifest.h"
#if defined(_WIN32)
# define POCO_LIBRARY_API __declspec(dllexport)
#else
# define POCO_LIBRARY_API
#endif
//

View File

@ -159,9 +159,6 @@
// Windows CE has no locale support
#if defined(_WIN32_WCE)
# define POCO_NO_LOCALE
#endif
// Enable the poco_debug_* and poco_trace_* macros

View File

@ -1,74 +0,0 @@
//
// DirectoryIterator_WIN32.h
//
// Library: Foundation
// Package: Filesystem
// Module: DirectoryIterator
//
// Definition of the DirectoryIteratorImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_DirectoryIterator_WIN32_INCLUDED
#define Foundation_DirectoryIterator_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API DirectoryIteratorImpl
{
public:
DirectoryIteratorImpl(const std::string & path);
~DirectoryIteratorImpl();
void duplicate();
void release();
const std::string & get() const;
const std::string & next();
private:
HANDLE _fh;
WIN32_FIND_DATA _fd;
std::string _current;
int _rc;
};
//
// inlines
//
const std::string & DirectoryIteratorImpl::get() const
{
return _current;
}
inline void DirectoryIteratorImpl::duplicate()
{
++_rc;
}
inline void DirectoryIteratorImpl::release()
{
if (--_rc == 0)
delete this;
}
} // namespace Poco
#endif // Foundation_DirectoryIterator_WIN32_INCLUDED

View File

@ -1,74 +0,0 @@
//
// DirectoryIterator_WIN32U.h
//
// Library: Foundation
// Package: Filesystem
// Module: DirectoryIterator
//
// Definition of the DirectoryIteratorImpl class for WIN32.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_DirectoryIterator_WIN32U_INCLUDED
#define Foundation_DirectoryIterator_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API DirectoryIteratorImpl
{
public:
DirectoryIteratorImpl(const std::string & path);
~DirectoryIteratorImpl();
void duplicate();
void release();
const std::string & get() const;
const std::string & next();
private:
HANDLE _fh;
WIN32_FIND_DATAW _fd;
std::string _current;
int _rc;
};
//
// inlines
//
const std::string & DirectoryIteratorImpl::get() const
{
return _current;
}
inline void DirectoryIteratorImpl::duplicate()
{
++_rc;
}
inline void DirectoryIteratorImpl::release()
{
if (--_rc == 0)
delete this;
}
} // namespace Poco
#endif // Foundation_DirectoryIterator_WIN32U_INCLUDED

View File

@ -1,57 +0,0 @@
//
// Environment_VX.h
//
// Library: Foundation
// Package: Core
// Module: Environment
//
// Definition of the EnvironmentImpl class for VxWorks.
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Environment_VX_INCLUDED
#define Foundation_Environment_VX_INCLUDED
#include <map>
#include "Poco/Foundation.h"
#include "Poco/Mutex.h"
namespace Poco
{
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string & name);
static bool hasImpl(const std::string & name);
static void setImpl(const std::string & name, const std::string & value);
static std::string osNameImpl();
static std::string osDisplayNameImpl();
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId & id);
static unsigned processorCountImpl();
private:
typedef std::map<std::string, std::string> StringMap;
static StringMap _map;
static FastMutex _mutex;
};
} // namespace Poco
#endif // Foundation_Environment_VX_INCLUDED

View File

@ -1,49 +0,0 @@
//
// Environment_WIN32.h
//
// Library: Foundation
// Package: Core
// Module: Environment
//
// Definition of the EnvironmentImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Environment_WIN32_INCLUDED
#define Foundation_Environment_WIN32_INCLUDED
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string & name);
static bool hasImpl(const std::string & name);
static void setImpl(const std::string & name, const std::string & value);
static std::string osNameImpl();
static std::string osDisplayNameImpl();
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId & id);
static unsigned processorCountImpl();
};
} // namespace Poco
#endif // Foundation_Environment_WIN32_INCLUDED

View File

@ -1,49 +0,0 @@
//
// Environment_WIN32U.h
//
// Library: Foundation
// Package: Core
// Module: Environment
//
// Definition of the EnvironmentImpl class for WIN32.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Environment_WIN32U_INCLUDED
#define Foundation_Environment_WIN32U_INCLUDED
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string & name);
static bool hasImpl(const std::string & name);
static void setImpl(const std::string & name, const std::string & value);
static std::string osNameImpl();
static std::string osDisplayNameImpl();
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId & id);
static unsigned processorCountImpl();
};
} // namespace Poco
#endif // Foundation_Environment_WIN32U_INCLUDED

View File

@ -1,60 +0,0 @@
//
// Environment_WINCE.h
//
// Library: Foundation
// Package: Core
// Module: Environment
//
// Definition of the EnvironmentImpl class for WINCE.
//
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Environment_WINCE_INCLUDED
#define Foundation_Environment_WINCE_INCLUDED
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API EnvironmentImpl
{
public:
typedef UInt8 NodeId[6]; /// Ethernet address.
static std::string getImpl(const std::string & name);
static bool hasImpl(const std::string & name);
static void setImpl(const std::string & name, const std::string & value);
static std::string osNameImpl();
static std::string osDisplayNameImpl();
static std::string osVersionImpl();
static std::string osArchitectureImpl();
static std::string nodeNameImpl();
static void nodeIdImpl(NodeId & id);
static unsigned processorCountImpl();
private:
static bool envVar(const std::string & name, std::string * value);
static const std::string TEMP;
static const std::string TMP;
static const std::string HOMEPATH;
static const std::string COMPUTERNAME;
static const std::string OS;
static const std::string NUMBER_OF_PROCESSORS;
static const std::string PROCESSOR_ARCHITECTURE;
};
} // namespace Poco
#endif // Foundation_Environment_WINCE_INCLUDED

View File

@ -30,19 +30,11 @@ class Foundation_API Error
/// for error reporting.
{
public:
#ifdef POCO_OS_FAMILY_WINDOWS
static DWORD last();
/// Utility function returning the last error.
static std::string getMessage(DWORD errorCode);
/// Utility function translating numeric error code to string.
#else
static int last();
/// Utility function returning the last error.
static std::string getMessage(int errorCode);
/// Utility function translating numeric error code to string.
#endif
};

View File

@ -22,13 +22,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/Event_WIN32.h"
#elif defined(POCO_VXWORKS)
# include "Poco/Event_VX.h"
#else
# include "Poco/Event_POSIX.h"
#endif
namespace Poco

View File

@ -86,11 +86,7 @@ protected:
static int getType(const Message & msg);
static int getCategory(const Message & msg);
void setUpRegistry() const;
#if defined(POCO_WIN32_UTF8)
static std::wstring findLibrary(const wchar_t * name);
#else
static std::string findLibrary(const char * name);
#endif
private:
std::string _name;

View File

@ -1,50 +0,0 @@
//
// Event_VX.h
//
// Library: Foundation
// Package: Threading
// Module: Event
//
// Definition of the EventImpl class for VxWorks.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Event_VX_INCLUDED
#define Foundation_Event_VX_INCLUDED
#include <semLib.h>
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API EventImpl
{
protected:
EventImpl(bool autoReset);
~EventImpl();
void setImpl();
void waitImpl();
bool waitImpl(long milliseconds);
void resetImpl();
private:
bool _auto;
volatile bool _state;
SEM_ID _sem;
};
} // namespace Poco
#endif // Foundation_Event_VX_INCLUDED

View File

@ -1,69 +0,0 @@
//
// Event_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: Event
//
// Definition of the EventImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Event_WIN32_INCLUDED
#define Foundation_Event_WIN32_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API EventImpl
{
protected:
EventImpl(bool autoReset);
~EventImpl();
void setImpl();
void waitImpl();
bool waitImpl(long milliseconds);
void resetImpl();
private:
HANDLE _event;
};
//
// inlines
//
inline void EventImpl::setImpl()
{
if (!SetEvent(_event))
{
throw SystemException("cannot signal event");
}
}
inline void EventImpl::resetImpl()
{
if (!ResetEvent(_event))
{
throw SystemException("cannot reset event");
}
}
} // namespace Poco
#endif // Foundation_Event_WIN32_INCLUDED

View File

@ -27,12 +27,8 @@
# include "Poco/FPEnvironment_DEC.h"
#elif defined(sun) || defined(__sun)
# include "Poco/FPEnvironment_SUN.h"
#elif defined(__QNX__)
# include "Poco/FPEnvironment_QNX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
# include "Poco/FPEnvironment_C99.h"
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/FPEnvironment_WIN32.h"
#else
# include "Poco/FPEnvironment_DUMMY.h"
#endif

View File

@ -1,90 +0,0 @@
//
// FPEnvironment_DEC.h
//
// Library: Foundation
// Package: Core
// Module: FPEnvironment
//
// Definitions of class FPEnvironmentImpl for Tru64 and OpenVMS Alpha.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_FPEnvironment_DEC_INCLUDED
#define Foundation_FPEnvironment_DEC_INCLUDED
#include "Poco/Foundation.h"
#if defined(__VMS)
# include <ieeedef.h>
#else
# include <machine/fpu.h>
#endif
namespace Poco
{
class FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = 0,
FP_ROUND_UPWARD_IMPL = 0,
FP_ROUND_TONEAREST_IMPL = 0,
FP_ROUND_TOWARDZERO_IMPL = 0
};
enum FlagImpl
{
#if defined(__VMS)
FP_DIVIDE_BY_ZERO_IMPL = IEEE$M_STATUS_DZE,
FP_INEXACT_IMPL = IEEE$M_STATUS_INE,
FP_OVERFLOW_IMPL = IEEE$M_STATUS_OVF,
FP_UNDERFLOW_IMPL = IEEE$M_STATUS_UNF,
FP_INVALID_IMPL = IEEE$M_STATUS_INV
#else
FP_DIVIDE_BY_ZERO_IMPL = IEEE_STATUS_DZE,
FP_INEXACT_IMPL = IEEE_STATUS_INE,
FP_OVERFLOW_IMPL = IEEE_STATUS_OVF,
FP_UNDERFLOW_IMPL = IEEE_STATUS_UNF,
FP_INVALID_IMPL = IEEE_STATUS_INV
#endif
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl & env);
~FPEnvironmentImpl();
FPEnvironmentImpl & operator=(const FPEnvironmentImpl & env);
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);
static RoundingModeImpl getRoundingModeImpl();
static bool isInfiniteImpl(float value);
static bool isInfiniteImpl(double value);
static bool isInfiniteImpl(long double value);
static bool isNaNImpl(float value);
static bool isNaNImpl(double value);
static bool isNaNImpl(long double value);
static float copySignImpl(float target, float source);
static double copySignImpl(double target, double source);
static long double copySignImpl(long double target, long double source);
private:
#if defined(__VMS)
struct _ieee _env;
#else
unsigned long _env;
#endif
};
} // namespace Poco
#endif // Foundation_FPEnvironment_DEC_INCLUDED

View File

@ -1,134 +0,0 @@
//
// FPEnvironment_QNX.h
//
// Library: Foundation
// Package: Core
// Module: FPEnvironment
//
// Definitions of class FPEnvironmentImpl for QNX.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_FPEnvironment_QNX_INCLUDED
#define Foundation_FPEnvironment_QNX_INCLUDED
#include <cmath>
#include <fenv.h>
#include "Poco/Foundation.h"
namespace Poco
{
class FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = FE_DOWNWARD,
FP_ROUND_UPWARD_IMPL = FE_UPWARD,
FP_ROUND_TONEAREST_IMPL = FE_TONEAREST,
FP_ROUND_TOWARDZERO_IMPL = FE_TOWARDZERO
};
enum FlagImpl
{
FP_DIVIDE_BY_ZERO_IMPL = FE_DIVBYZERO,
FP_INEXACT_IMPL = FE_INEXACT,
FP_OVERFLOW_IMPL = FE_OVERFLOW,
FP_UNDERFLOW_IMPL = FE_UNDERFLOW,
FP_INVALID_IMPL = FE_INVALID
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl & env);
~FPEnvironmentImpl();
FPEnvironmentImpl & operator=(const FPEnvironmentImpl & env);
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);
static RoundingModeImpl getRoundingModeImpl();
static bool isInfiniteImpl(float value);
static bool isInfiniteImpl(double value);
static bool isInfiniteImpl(long double value);
static bool isNaNImpl(float value);
static bool isNaNImpl(double value);
static bool isNaNImpl(long double value);
static float copySignImpl(float target, float source);
static double copySignImpl(double target, double source);
static long double copySignImpl(long double target, long double source);
private:
fenv_t _env;
};
//
// inlines
//
inline bool FPEnvironmentImpl::isInfiniteImpl(float value)
{
using namespace std;
return isinf(value) != 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(double value)
{
using namespace std;
return isinf(value) != 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(long double value)
{
using namespace std;
return isinf((double)value) != 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(float value)
{
using namespace std;
return isnan(value) != 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(double value)
{
using namespace std;
return isnan(value) != 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(long double value)
{
using namespace std;
return isnan((double)value) != 0;
}
inline float FPEnvironmentImpl::copySignImpl(float target, float source)
{
using namespace std;
return copysignf(target, source);
}
inline double FPEnvironmentImpl::copySignImpl(double target, double source)
{
using namespace std;
return copysign(target, source);
}
} // namespace Poco
#endif // Foundation_FPEnvironment_QNX_INCLUDED

View File

@ -1,75 +0,0 @@
//
// FPEnvironment_SUN.h
//
// Library: Foundation
// Package: Core
// Module: FPEnvironment
//
// Definitions of class FPEnvironmentImpl for Solaris.
//
// Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_FPEnvironment_SUN_INCLUDED
#define Foundation_FPEnvironment_SUN_INCLUDED
#include <ieeefp.h>
#include "Poco/Foundation.h"
namespace Poco
{
class FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = FP_RM,
FP_ROUND_UPWARD_IMPL = FP_RP,
FP_ROUND_TONEAREST_IMPL = FP_RN,
FP_ROUND_TOWARDZERO_IMPL = FP_RZ
};
enum FlagImpl
{
FP_DIVIDE_BY_ZERO_IMPL = FP_X_DZ,
FP_INEXACT_IMPL = FP_X_IMP,
FP_OVERFLOW_IMPL = FP_X_OFL,
FP_UNDERFLOW_IMPL = FP_X_UFL,
FP_INVALID_IMPL = FP_X_INV
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl & env);
~FPEnvironmentImpl();
FPEnvironmentImpl & operator=(const FPEnvironmentImpl & env);
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);
static RoundingModeImpl getRoundingModeImpl();
static bool isInfiniteImpl(float value);
static bool isInfiniteImpl(double value);
static bool isInfiniteImpl(long double value);
static bool isNaNImpl(float value);
static bool isNaNImpl(double value);
static bool isNaNImpl(long double value);
static float copySignImpl(float target, float source);
static double copySignImpl(double target, double source);
static long double copySignImpl(long double target, long double source);
private:
fp_rnd _rnd;
fp_except _exc;
};
} // namespace Poco
#endif // Foundation_FPEnvironment_SUN_INCLUDED

View File

@ -1,151 +0,0 @@
//
// FPEnvironment_WIN32.h
//
// Library: Foundation
// Package: Core
// Module: FPEnvironment
//
// Definitions of class FPEnvironmentImpl for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_FPEnvironment_WIN32_INCLUDED
#define Foundation_FPEnvironment_WIN32_INCLUDED
#include <float.h>
#include <math.h>
#include "Poco/Foundation.h"
#ifndef _SW_INEXACT
# define _SW_INEXACT 0x00000001 // inexact (precision)
#endif
#ifndef _SW_UNDERFLOW
# define _SW_UNDERFLOW 0x00000002 // underflow
#endif
#ifndef _SW_OVERFLOW
# define _SW_OVERFLOW 0x00000004 // overflow
#endif
#ifndef _SW_ZERODIVIDE
# define _SW_ZERODIVIDE 0x00000008 // zero divide
#endif
#ifndef _SW_INVALID
# define _SW_INVALID 0x00000010 // invalid
#endif
#ifndef _SW_DENORMAL
# define _SW_DENORMAL 0x00080000 // denormal status bit
#endif
namespace Poco
{
class Foundation_API FPEnvironmentImpl
{
protected:
enum RoundingModeImpl
{
FP_ROUND_DOWNWARD_IMPL = _RC_DOWN,
FP_ROUND_UPWARD_IMPL = _RC_UP,
FP_ROUND_TONEAREST_IMPL = _RC_NEAR,
FP_ROUND_TOWARDZERO_IMPL = _RC_CHOP
};
enum FlagImpl
{
FP_DIVIDE_BY_ZERO_IMPL = _SW_ZERODIVIDE,
FP_INEXACT_IMPL = _SW_INEXACT,
FP_OVERFLOW_IMPL = _SW_OVERFLOW,
FP_UNDERFLOW_IMPL = _SW_UNDERFLOW,
FP_INVALID_IMPL = _SW_INVALID
};
FPEnvironmentImpl();
FPEnvironmentImpl(const FPEnvironmentImpl & env);
~FPEnvironmentImpl();
FPEnvironmentImpl & operator=(const FPEnvironmentImpl & env);
void keepCurrentImpl();
static void clearFlagsImpl();
static bool isFlagImpl(FlagImpl flag);
static void setRoundingModeImpl(RoundingModeImpl mode);
static RoundingModeImpl getRoundingModeImpl();
static bool isInfiniteImpl(float value);
static bool isInfiniteImpl(double value);
static bool isInfiniteImpl(long double value);
static bool isNaNImpl(float value);
static bool isNaNImpl(double value);
static bool isNaNImpl(long double value);
static float copySignImpl(float target, float source);
static double copySignImpl(double target, double source);
static long double copySignImpl(long double target, long double source);
private:
unsigned _env;
};
//
// inlines
//
inline bool FPEnvironmentImpl::isInfiniteImpl(float value)
{
return _finite(value) == 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(double value)
{
return _finite(value) == 0;
}
inline bool FPEnvironmentImpl::isInfiniteImpl(long double value)
{
return _finite(value) == 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(float value)
{
return _isnan(value) != 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(double value)
{
return _isnan(value) != 0;
}
inline bool FPEnvironmentImpl::isNaNImpl(long double value)
{
return _isnan(value) != 0;
}
inline float FPEnvironmentImpl::copySignImpl(float target, float source)
{
return float(_copysign(target, source));
}
inline double FPEnvironmentImpl::copySignImpl(double target, double source)
{
return _copysign(target, source);
}
inline long double FPEnvironmentImpl::copySignImpl(long double target, long double source)
{
return (source > 0 && target > 0) || (source < 0 && target < 0) ? target : -target;
}
} // namespace Poco
#endif // Foundation_FPEnvironment_WIN32_INCLUDED

View File

@ -23,17 +23,7 @@
#include "Poco/Timestamp.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# if defined(_WIN32_WCE)
# include "File_WINCE.h"
# else
# include "Poco/File_WIN32U.h"
# endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/File_WIN32.h"
#elif defined(POCO_VXWORKS)
# include "Poco/File_VX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
#if defined(POCO_OS_FAMILY_UNIX)
# include "Poco/File_UNIX.h"
#endif

View File

@ -19,11 +19,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/FileStream_WIN32.h"
#else
# include "Poco/FileStream_POSIX.h"
#endif
#include <istream>
#include <ostream>

View File

@ -1,85 +0,0 @@
//
// File_VX.h
//
// Library: Foundation
// Package: Filesystem
// Module: File
//
// Definition of the FileImpl class for VxWorks.
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_File_VX_INCLUDED
#define Foundation_File_VX_INCLUDED
#include "Poco/Foundation.h"
namespace Poco
{
class FileImpl
{
protected:
typedef UInt64 FileSizeImpl;
FileImpl();
FileImpl(const std::string & path);
virtual ~FileImpl();
void swapImpl(FileImpl & file);
void setPathImpl(const std::string & path);
const std::string & getPathImpl() const;
bool existsImpl() const;
bool canReadImpl() const;
bool canWriteImpl() const;
bool canExecuteImpl() const;
bool isFileImpl() const;
bool isDirectoryImpl() const;
bool isLinkImpl() const;
bool isDeviceImpl() const;
bool isHiddenImpl() const;
Timestamp createdImpl() const;
Timestamp getLastModifiedImpl() const;
void setLastModifiedImpl(const Timestamp & ts);
FileSizeImpl getSizeImpl() const;
void setSizeImpl(FileSizeImpl size);
void setWriteableImpl(bool flag = true);
void setExecutableImpl(bool flag = true);
void copyToImpl(const std::string & path) const;
void renameToImpl(const std::string & path);
void linkToImpl(const std::string & path, int type) const;
void removeImpl();
bool createFileImpl();
bool createDirectoryImpl();
FileSizeImpl totalSpaceImpl() const;
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string & path);
private:
std::string _path;
friend class DirectoryIteratorImpl;
};
//
// inlines
//
inline const std::string & FileImpl::getPathImpl() const
{
return _path;
}
} // namespace Poco
#endif // Foundation_File_VX_INCLUDED

View File

@ -1,88 +0,0 @@
//
// File_WIN32.h
//
// Library: Foundation
// Package: Filesystem
// Module: File
//
// Definition of the FileImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_File_WIN32_INCLUDED
#define Foundation_File_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
namespace Poco
{
class Foundation_API FileImpl
{
protected:
typedef UInt64 FileSizeImpl;
FileImpl();
FileImpl(const std::string & path);
virtual ~FileImpl();
void swapImpl(FileImpl & file);
void setPathImpl(const std::string & path);
const std::string & getPathImpl() const;
bool existsImpl() const;
bool canReadImpl() const;
bool canWriteImpl() const;
bool canExecuteImpl() const;
bool isFileImpl() const;
bool isDirectoryImpl() const;
bool isLinkImpl() const;
bool isDeviceImpl() const;
bool isHiddenImpl() const;
Timestamp createdImpl() const;
Timestamp getLastModifiedImpl() const;
void setLastModifiedImpl(const Timestamp & ts);
FileSizeImpl getSizeImpl() const;
void setSizeImpl(FileSizeImpl size);
void setWriteableImpl(bool flag = true);
void setExecutableImpl(bool flag = true);
void copyToImpl(const std::string & path) const;
void renameToImpl(const std::string & path);
void linkToImpl(const std::string & path, int type) const;
void removeImpl();
bool createFileImpl();
bool createDirectoryImpl();
FileSizeImpl totalSpaceImpl() const;
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string & path);
private:
std::string _path;
friend class FileHandle;
friend class DirectoryIteratorImpl;
friend class WindowsDirectoryWatcherStrategy;
};
//
// inlines
//
inline const std::string & FileImpl::getPathImpl() const
{
return _path;
}
} // namespace Poco
#endif // Foundation_File_WIN32_INCLUDED

View File

@ -1,92 +0,0 @@
//
// File_WIN32U.h
//
// Library: Foundation
// Package: Filesystem
// Module: File
//
// Definition of the Unicode FileImpl class for WIN32.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_File_WIN32U_INCLUDED
#define Foundation_File_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
namespace Poco
{
class Foundation_API FileImpl
{
protected:
typedef UInt64 FileSizeImpl;
FileImpl();
FileImpl(const std::string & path);
virtual ~FileImpl();
void swapImpl(FileImpl & file);
void setPathImpl(const std::string & path);
const std::string & getPathImpl() const;
bool existsImpl() const;
bool canReadImpl() const;
bool canWriteImpl() const;
bool canExecuteImpl() const;
bool isFileImpl() const;
bool isDirectoryImpl() const;
bool isLinkImpl() const;
bool isDeviceImpl() const;
bool isHiddenImpl() const;
Timestamp createdImpl() const;
Timestamp getLastModifiedImpl() const;
void setLastModifiedImpl(const Timestamp & ts);
FileSizeImpl getSizeImpl() const;
void setSizeImpl(FileSizeImpl size);
void setWriteableImpl(bool flag = true);
void setExecutableImpl(bool flag = true);
void copyToImpl(const std::string & path) const;
void renameToImpl(const std::string & path);
void linkToImpl(const std::string & path, int type) const;
void removeImpl();
bool createFileImpl();
bool createDirectoryImpl();
FileSizeImpl totalSpaceImpl() const;
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string & path);
static void convertPath(const std::string & utf8Path, std::wstring & utf16Path);
private:
std::string _path;
std::wstring _upath;
friend class FileHandle;
friend class DirectoryIteratorImpl;
friend class WindowsDirectoryWatcherStrategy;
friend class FileStreamBuf;
friend class LogFileImpl;
};
//
// inlines
//
inline const std::string & FileImpl::getPathImpl() const
{
return _path;
}
} // namespace Poco
#endif // Foundation_File_WIN32U_INCLUDED

View File

@ -1,91 +0,0 @@
//
// File_WIN32U.h
//
// Library: Foundation
// Package: Filesystem
// Module: File
//
// Definition of the Unicode FileImpl class for WIN32.
//
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_File_WINCE_INCLUDED
#define Foundation_File_WINCE_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
namespace Poco
{
class Foundation_API FileImpl
{
protected:
typedef UInt64 FileSizeImpl;
FileImpl();
FileImpl(const std::string & path);
virtual ~FileImpl();
void swapImpl(FileImpl & file);
void setPathImpl(const std::string & path);
const std::string & getPathImpl() const;
bool existsImpl() const;
bool canReadImpl() const;
bool canWriteImpl() const;
bool canExecuteImpl() const;
bool isFileImpl() const;
bool isDirectoryImpl() const;
bool isLinkImpl() const;
bool isDeviceImpl() const;
bool isHiddenImpl() const;
Timestamp createdImpl() const;
Timestamp getLastModifiedImpl() const;
void setLastModifiedImpl(const Timestamp & ts);
FileSizeImpl getSizeImpl() const;
void setSizeImpl(FileSizeImpl size);
void setWriteableImpl(bool flag = true);
void setExecutableImpl(bool flag = true);
void copyToImpl(const std::string & path) const;
void renameToImpl(const std::string & path);
void linkToImpl(const std::string & path, int type) const;
void removeImpl();
bool createFileImpl();
bool createDirectoryImpl();
FileSizeImpl totalSpaceImpl() const;
FileSizeImpl usableSpaceImpl() const;
FileSizeImpl freeSpaceImpl() const;
static void handleLastErrorImpl(const std::string & path);
static void convertPath(const std::string & utf8Path, std::wstring & utf16Path);
private:
std::string _path;
std::wstring _upath;
friend class FileHandle;
friend class DirectoryIteratorImpl;
friend class FileStreamBuf;
friend class LogFileImpl;
};
//
// inlines
//
inline const std::string & FileImpl::getPathImpl() const
{
return _path;
}
} // namespace Poco
#endif // Foundation_File_WINCE_INCLUDED

View File

@ -29,11 +29,6 @@
//
// Ensure that POCO_DLL is default unless POCO_STATIC is defined
//
#if defined(_WIN32) && defined(_DLL)
# if !defined(POCO_DLL) && !defined(POCO_STATIC)
# define POCO_DLL
# endif
#endif
//
@ -44,13 +39,6 @@
// Foundation_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
//
#if (defined(_WIN32) || defined(_WIN32_WCE)) && defined(POCO_DLL)
# if defined(Foundation_EXPORTS)
# define Foundation_API __declspec(dllexport)
# else
# define Foundation_API __declspec(dllimport)
# endif
#endif
#if !defined(Foundation_API)
@ -65,42 +53,13 @@
//
// Automatically link Foundation library.
//
#if defined(_MSC_VER)
# if defined(POCO_DLL)
# if defined(_DEBUG)
# define POCO_LIB_SUFFIX "d.lib"
# else
# define POCO_LIB_SUFFIX ".lib"
# endif
# elif defined(_DLL)
# if defined(_DEBUG)
# define POCO_LIB_SUFFIX "mdd.lib"
# else
# define POCO_LIB_SUFFIX "md.lib"
# endif
# else
# if defined(_DEBUG)
# define POCO_LIB_SUFFIX "mtd.lib"
# else
# define POCO_LIB_SUFFIX "mt.lib"
# endif
# endif
# if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Foundation_EXPORTS)
# pragma comment(lib, "PocoFoundation" POCO_LIB_SUFFIX)
# endif
#endif
//
// Include platform-specific definitions
//
#include "Poco/Platform.h"
#if defined(_WIN32)
# include "Poco/Platform_WIN32.h"
#elif defined(POCO_VXWORKS)
# include "Poco/Platform_VX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
#if defined(POCO_OS_FAMILY_UNIX)
# include "Poco/Platform_POSIX.h"
#endif
@ -113,15 +72,6 @@
//
// Cleanup inconsistencies
//
#ifdef POCO_OS_FAMILY_WINDOWS
# if defined(POCO_WIN32_UTF8) && defined(POCO_NO_WSTRING)
# error POCO_WIN32_UTF8 and POCO_NO_WSTRING are mutually exclusive.
# endif
#else
# ifdef POCO_WIN32_UTF8
# undef POCO_WIN32_UTF8
# endif
#endif
//
@ -150,8 +100,6 @@
# define POCO_DEPRECATED __attribute__((deprecated))
#elif defined(__clang__)
# define POCO_DEPRECATED __attribute__((deprecated))
#elif defined(_MSC_VER)
# define POCO_DEPRECATED __declspec(deprecated)
#else
# define POCO_DEPRECATED
#endif

View File

@ -21,13 +21,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# include "Poco/LogFile_WIN32U.h"
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/LogFile_WIN32.h"
#else
# include "Poco/LogFile_STD.h"
#endif
namespace Poco

View File

@ -1,56 +0,0 @@
//
// LogFile_WIN32.h
//
// Library: Foundation
// Package: Logging
// Module: LogFile
//
// Definition of the LogFileImpl class using the Windows file APIs.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_LogFile_WIN32_INCLUDED
#define Foundation_LogFile_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API LogFileImpl
/// The implementation of LogFile for Windows.
/// The native filesystem APIs are used for
/// total control over locking behavior.
{
public:
LogFileImpl(const std::string & path);
~LogFileImpl();
void writeImpl(const std::string & text, bool flush);
void writeBinaryImpl(const char * data, size_t size, bool flush);
UInt64 sizeImpl() const;
Timestamp creationDateImpl() const;
const std::string & pathImpl() const;
private:
void createFile();
std::string _path;
HANDLE _hFile;
Timestamp _creationDate;
};
} // namespace Poco
#endif // Foundation_LogFile_WIN32_INCLUDED

View File

@ -1,56 +0,0 @@
//
// LogFile_WIN32U.h
//
// Library: Foundation
// Package: Logging
// Module: LogFile
//
// Definition of the LogFileImpl class using the Windows file APIs.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_LogFile_WIN32U_INCLUDED
#define Foundation_LogFile_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Timestamp.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API LogFileImpl
/// The implementation of LogFile for Windows.
/// The native filesystem APIs are used for
/// total control over locking behavior.
{
public:
LogFileImpl(const std::string & path);
~LogFileImpl();
void writeImpl(const std::string & text, bool flush);
void writeBinaryImpl(const char * data, size_t size, bool flush);
UInt64 sizeImpl() const;
Timestamp creationDateImpl() const;
const std::string & pathImpl() const;
private:
void createFile();
std::string _path;
HANDLE _hFile;
Timestamp _creationDate;
};
} // namespace Poco
#endif // Foundation_LogFile_WIN32U_INCLUDED

View File

@ -23,17 +23,7 @@
#include "Poco/ScopedLock.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# if defined(_WIN32_WCE)
# include "Poco/Mutex_WINCE.h"
# else
# include "Poco/Mutex_WIN32.h"
# endif
#elif defined(POCO_VXWORKS)
# include "Poco/Mutex_VX.h"
#else
# include "Poco/Mutex_POSIX.h"
#endif
namespace Poco

View File

@ -1,81 +0,0 @@
//
// Mutex_VX.h
//
// Library: Foundation
// Package: Threading
// Module: Mutex
//
// Definition of the MutexImpl and FastMutexImpl classes for VxWorks.
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Mutex_VX_INCLUDED
#define Foundation_Mutex_VX_INCLUDED
#include <errno.h>
#include <semLib.h>
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API MutexImpl
{
protected:
MutexImpl();
MutexImpl(bool fast);
~MutexImpl();
void lockImpl();
bool tryLockImpl();
bool tryLockImpl(long milliseconds);
void unlockImpl();
private:
SEM_ID _sem;
};
class Foundation_API FastMutexImpl : public MutexImpl
{
protected:
FastMutexImpl();
~FastMutexImpl();
};
//
// inlines
//
inline void MutexImpl::lockImpl()
{
if (semTake(_sem, WAIT_FOREVER) != OK)
throw SystemException("cannot lock mutex");
}
inline bool MutexImpl::tryLockImpl()
{
return semTake(_sem, NO_WAIT) == OK;
}
inline void MutexImpl::unlockImpl()
{
if (semGive(_sem) != OK)
throw SystemException("cannot unlock mutex");
}
} // namespace Poco
#endif // Foundation_Mutex_VX_INCLUDED

View File

@ -1,86 +0,0 @@
//
// Mutex_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: Mutex
//
// Definition of the MutexImpl and FastMutexImpl classes for WIN32.
//
// Copyright (c) 2004-2008, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Mutex_WIN32_INCLUDED
#define Foundation_Mutex_WIN32_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API MutexImpl
{
protected:
MutexImpl();
~MutexImpl();
void lockImpl();
bool tryLockImpl();
bool tryLockImpl(long milliseconds);
void unlockImpl();
private:
CRITICAL_SECTION _cs;
};
typedef MutexImpl FastMutexImpl;
//
// inlines
//
inline void MutexImpl::lockImpl()
{
try
{
EnterCriticalSection(&_cs);
}
catch (...)
{
throw SystemException("cannot lock mutex");
}
}
inline bool MutexImpl::tryLockImpl()
{
try
{
return TryEnterCriticalSection(&_cs) != 0;
}
catch (...)
{
}
throw SystemException("cannot lock mutex");
}
inline void MutexImpl::unlockImpl()
{
LeaveCriticalSection(&_cs);
}
} // namespace Poco
#endif // Foundation_Mutex_WIN32_INCLUDED

View File

@ -1,51 +0,0 @@
//
// Mutex_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: Mutex
//
// Definition of the MutexImpl and FastMutexImpl classes for WIN32.
//
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Mutex_WINCE_INCLUDED
#define Foundation_Mutex_WINCE_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API MutexImpl
{
protected:
MutexImpl();
~MutexImpl();
void lockImpl();
bool tryLockImpl();
bool tryLockImpl(long milliseconds);
void unlockImpl();
private:
HANDLE _mutex;
};
typedef MutexImpl FastMutexImpl;
} // namespace Poco
#endif // Foundation_Mutex_WINCE_INCLUDED

View File

@ -21,11 +21,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# include "Poco/NamedEvent_WIN32U.h"
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/NamedEvent_WIN32.h"
#elif POCO_OS == POCO_OS_ANDROID
#if POCO_OS == POCO_OS_ANDROID
# include "Poco/NamedEvent_Android.h"
#elif defined(POCO_OS_FAMILY_UNIX)
# include "Poco/NamedEvent_UNIX.h"

View File

@ -1,46 +0,0 @@
//
// NamedEvent_WIN32.h
//
// Library: Foundation
// Package: Processes
// Module: NamedEvent
//
// Definition of the NamedEventImpl class for Windows.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_NamedEvent_WIN32_INCLUDED
#define Foundation_NamedEvent_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API NamedEventImpl
{
protected:
NamedEventImpl(const std::string & name);
~NamedEventImpl();
void setImpl();
void waitImpl();
private:
std::string _name;
HANDLE _event;
};
} // namespace Poco
#endif // Foundation_NamedEvent_WIN32_INCLUDED

View File

@ -1,47 +0,0 @@
//
// NamedEvent_WIN32U.h
//
// Library: Foundation
// Package: Processes
// Module: NamedEvent
//
// Definition of the NamedEventImpl class for Windows.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_NamedEvent_WIN32U_INCLUDED
#define Foundation_NamedEvent_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API NamedEventImpl
{
protected:
NamedEventImpl(const std::string & name);
~NamedEventImpl();
void setImpl();
void waitImpl();
private:
std::string _name;
std::wstring _uname;
HANDLE _event;
};
} // namespace Poco
#endif // Foundation_NamedEvent_WIN32U_INCLUDED

View File

@ -22,11 +22,7 @@
#include "Poco/ScopedLock.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# include "Poco/NamedMutex_WIN32U.h"
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/NamedMutex_WIN32.h"
#elif POCO_OS == POCO_OS_ANDROID
#if POCO_OS == POCO_OS_ANDROID
# include "Poco/NamedMutex_Android.h"
#elif defined(POCO_OS_FAMILY_UNIX)
# include "Poco/NamedMutex_UNIX.h"

View File

@ -1,47 +0,0 @@
//
// NamedMutex_WIN32.h
//
// Library: Foundation
// Package: Processes
// Module: NamedMutex
//
// Definition of the NamedMutexImpl class for Windows.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_NamedMutex_WIN32_INCLUDED
#define Foundation_NamedMutex_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API NamedMutexImpl
{
protected:
NamedMutexImpl(const std::string & name);
~NamedMutexImpl();
void lockImpl();
bool tryLockImpl();
void unlockImpl();
private:
std::string _name;
HANDLE _mutex;
};
} // namespace Poco
#endif // Foundation_NamedMutex_WIN32_INCLUDED

View File

@ -1,48 +0,0 @@
//
// NamedMutex_WIN32U.h
//
// Library: Foundation
// Package: Processes
// Module: NamedMutex
//
// Definition of the NamedMutexImpl class for Windows.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_NamedMutex_WIN32U_INCLUDED
#define Foundation_NamedMutex_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API NamedMutexImpl
{
protected:
NamedMutexImpl(const std::string & name);
~NamedMutexImpl();
void lockImpl();
bool tryLockImpl();
void unlockImpl();
private:
std::string _name;
std::wstring _uname;
HANDLE _mutex;
};
} // namespace Poco
#endif // Foundation_NamedMutex_WIN32U_INCLUDED

View File

@ -470,8 +470,6 @@ inline char Path::separator()
{
#if defined(POCO_OS_FAMILY_VMS)
return '.';
#elif defined(POCO_OS_FAMILY_WINDOWS)
return '\\';
#else
return '/';
#endif
@ -482,8 +480,6 @@ inline char Path::pathSeparator()
{
#if defined(POCO_OS_FAMILY_VMS)
return ',';
#elif defined(POCO_OS_FAMILY_WINDOWS)
return ';';
#else
return ':';
#endif

View File

@ -1,50 +0,0 @@
//
// Path_WIN32.h
//
// Library: Foundation
// Package: Filesystem
// Module: Path
//
// Definition of the PathImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Path_WIN32_INCLUDED
#define Foundation_Path_WIN32_INCLUDED
#include <vector>
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API PathImpl
{
public:
static std::string currentImpl();
static std::string homeImpl();
static std::string configHomeImpl();
static std::string dataHomeImpl();
static std::string cacheHomeImpl();
static std::string tempHomeImpl();
static std::string tempImpl();
static std::string configImpl();
static std::string nullImpl();
static std::string systemImpl();
static std::string expandImpl(const std::string & path);
static void listRootsImpl(std::vector<std::string> & roots);
};
} // namespace Poco
#endif // Foundation_Path_WIN32_INCLUDED

View File

@ -1,55 +0,0 @@
//
// Path_WIN32U.h
//
// Library: Foundation
// Package: Filesystem
// Module: Path
//
// Definition of the PathImpl class for WIN32.
//
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Path_WIN32U_INCLUDED
#define Foundation_Path_WIN32U_INCLUDED
#include <vector>
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API PathImpl
{
public:
static std::string currentImpl();
static std::string homeImpl();
static std::string configHomeImpl();
static std::string dataHomeImpl();
static std::string cacheHomeImpl();
static std::string tempHomeImpl();
static std::string tempImpl();
static std::string configImpl();
static std::string nullImpl();
static std::string systemImpl();
static std::string expandImpl(const std::string & path);
static void listRootsImpl(std::vector<std::string> & roots);
enum
{
MAX_PATH_LEN = 32767
};
};
} // namespace Poco
#endif // Foundation_Path_WIN32U_INCLUDED

View File

@ -1,55 +0,0 @@
//
// Path_WINCE.h
//
// Library: Foundation
// Package: Filesystem
// Module: Path
//
// Definition of the PathImpl class for WIN32.
//
// Copyright (c) 2006-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Path_WINCE_INCLUDED
#define Foundation_Path_WINCE_INCLUDED
#include <vector>
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API PathImpl
{
public:
static std::string currentImpl();
static std::string homeImpl();
static std::string configHomeImpl();
static std::string dataHomeImpl();
static std::string cacheHomeImpl();
static std::string tempHomeImpl();
static std::string tempImpl();
static std::string configImpl();
static std::string nullImpl();
static std::string systemImpl();
static std::string expandImpl(const std::string & path);
static void listRootsImpl(std::vector<std::string> & roots);
enum
{
MAX_PATH_LEN = 32767
};
};
} // namespace Poco
#endif // Foundation_Path_WINCE_INCLUDED

View File

@ -21,13 +21,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# if defined(_WIN32_WCE)
# include "PipeImpl_DUMMY.h"
# else
# include "Poco/PipeImpl_WIN32.h"
# endif
#elif defined(POCO_OS_FAMILY_UNIX)
#if defined(POCO_OS_FAMILY_UNIX)
# include "Poco/PipeImpl_POSIX.h"
#else
# include "Poco/PipeImpl_DUMMY.h"

View File

@ -1,55 +0,0 @@
//
// PipeImpl_WIN32.h
//
// Library: Foundation
// Package: Processes
// Module: PipeImpl
//
// Definition of the PipeImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_PipeImpl_WIN32_INCLUDED
#define Foundation_PipeImpl_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API PipeImpl : public RefCountedObject
/// A dummy implementation of PipeImpl for platforms
/// that do not support pipes.
{
public:
typedef HANDLE Handle;
PipeImpl();
~PipeImpl();
int writeBytes(const void * buffer, int length);
int readBytes(void * buffer, int length);
Handle readHandle() const;
Handle writeHandle() const;
void closeRead();
void closeWrite();
private:
HANDLE _readHandle;
HANDLE _writeHandle;
};
} // namespace Poco
#endif // Foundation_PipeImpl_WIN32_INCLUDED

View File

@ -86,27 +86,12 @@
#elif defined(sun) || defined(__sun)
# define POCO_OS_FAMILY_UNIX 1
# define POCO_OS POCO_OS_SOLARIS
#elif defined(__QNX__)
# define POCO_OS_FAMILY_UNIX 1
# define POCO_OS POCO_OS_QNX
#elif defined(__CYGWIN__)
# define POCO_OS_FAMILY_UNIX 1
# define POCO_OS POCO_OS_CYGWIN
#elif defined(POCO_VXWORKS)
# define POCO_OS_FAMILY_UNIX 1
# define POCO_OS POCO_OS_VXWORKS
#elif defined(unix) || defined(__unix) || defined(__unix__)
# define POCO_OS_FAMILY_UNIX 1
# define POCO_OS POCO_OS_UNKNOWN_UNIX
#elif defined(_WIN32_WCE)
# define POCO_OS_FAMILY_WINDOWS 1
# define POCO_OS POCO_OS_WINDOWS_CE
#elif defined(_WIN32) || defined(_WIN64)
# define POCO_OS_FAMILY_WINDOWS 1
# define POCO_OS POCO_OS_WINDOWS_NT
#elif defined(__VMS)
# define POCO_OS_FAMILY_VMS 1
# define POCO_OS POCO_OS_VMS
#endif
@ -155,10 +140,7 @@
# define POCO_ARCH_LITTLE_ENDIAN 1
#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000)
# define POCO_ARCH POCO_ARCH_MIPS
# if defined(POCO_OS_FAMILY_WINDOWS)
// Is this OK? Supports windows only little endian??
# define POCO_ARCH_LITTLE_ENDIAN 1
# elif defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB)
# if defined(__MIPSEB__) || defined(_MIPSEB) || defined(__MIPSEB)
# define POCO_ARCH_BIG_ENDIAN 1
# elif defined(__MIPSEL__) || defined(_MIPSEL) || defined(__MIPSEL)
# define POCO_ARCH_LITTLE_ENDIAN 1
@ -232,32 +214,20 @@
#if defined(__clang__)
# define POCO_COMPILER_CLANG
#elif defined(_MSC_VER)
# define POCO_COMPILER_MSVC
#elif defined(__GNUC__)
# define POCO_COMPILER_GCC
#elif defined(__MINGW32__) || defined(__MINGW64__)
# define POCO_COMPILER_MINGW
#elif defined(__INTEL_COMPILER) || defined(__ICC) || defined(__ECC) || defined(__ICL)
# define POCO_COMPILER_INTEL
#elif defined(__SUNPRO_CC)
# define POCO_COMPILER_SUN
#elif defined(__MWERKS__) || defined(__CWCC__)
# define POCO_COMPILER_CODEWARRIOR
#elif defined(__sgi) || defined(sgi)
# define POCO_COMPILER_SGI
#elif defined(__HP_aCC)
# define POCO_COMPILER_HP_ACC
#elif defined(__BORLANDC__) || defined(__CODEGEARC__)
# define POCO_COMPILER_CBUILDER
#elif defined(__DMC__)
# define POCO_COMPILER_DMARS
#elif defined(__DECCXX)
# define POCO_COMPILER_COMPAC
#elif (defined(__xlc__) || defined(__xlC__)) && defined(__IBMCPP__)
# define POCO_COMPILER_IBM_XLC // IBM XL C++
#elif defined(__IBMCPP__) && defined(__COMPILER_VER__)
# define POCO_COMPILER_IBM_XLC_ZOS // IBM z/OS C++
#endif
@ -273,11 +243,7 @@
#endif
#if defined(POCO_OS_FAMILY_WINDOWS)
# define POCO_DEFAULT_NEWLINE_CHARS "\r\n"
#else
# define POCO_DEFAULT_NEWLINE_CHARS "\n"
#endif
#endif // Foundation_Platform_INCLUDED

View File

@ -25,9 +25,6 @@
#if defined(hpux) || defined(_hpux)
# if defined(__hppa) || defined(__hppa__)
# define POCO_NO_SYS_SELECT_H 1
# if defined(__HP_aCC)
# define POCO_NO_TEMPLATE_ICOMPARE 1
# endif
# endif
#endif

View File

@ -1,29 +0,0 @@
//
// Platform_VX.h
//
// Library: Foundation
// Package: Core
// Module: Platform
//
// Platform and architecture identification macros
// and platform-specific definitions for VxWorks
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Platform_VX_INCLUDED
#define Foundation_Platform_VX_INCLUDED
#define POCO_NO_SYS_SELECT_H
#define POCO_NO_FPENVIRONMENT
#define POCO_NO_WSTRING
#define POCO_NO_SHAREDMEMORY
#define POCO_NO_SYSLOGCHANNEL
#endif // Foundation_Platform_VX_INCLUDED

View File

@ -1,217 +0,0 @@
//
// Platform_WIN32.h
//
// Library: Foundation
// Package: Core
// Module: Platform
//
// Platform and architecture identification macros
// and platform-specific definitions for Windows.
//
// Copyright (c) 2004-2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Platform_WIN32_INCLUDED
#define Foundation_Platform_WIN32_INCLUDED
#include "Poco/UnWindows.h"
#ifndef POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
// Determine the real version.
// This setting can be forced from UnWindows.h
# if defined(_WIN32_WINNT_WINBLUE)
//Windows 8.1 _WIN32_WINNT_WINBLUE (0x0602)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WINBLUE
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WINBLUE
# elif defined(_WIN32_WINNT_WIN8)
//Windows 8 _WIN32_WINNT_WIN8 (0x0602)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WIN8
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WIN8
# elif defined(_WIN32_WINNT_WIN7)
//Windows 7 _WIN32_WINNT_WIN7 (0x0601)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WIN7
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WIN7
# elif defined(_WIN32_WINNT_WS08)
//Windows Server 2008 _WIN32_WINNT_WS08 (0x0600)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WS08
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WS08
# elif defined(_WIN32_WINNT_VISTA)
//Windows Vista _WIN32_WINNT_VISTA (0x0600)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_VISTA
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_VISTA
# elif defined(_WIN32_WINNT_LONGHORN)
//Windows Vista and server 2008 Development _WIN32_WINNT_LONGHORN (0x0600)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_LONGHORN
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION 0x06000000 // hardcoded, VS90 can't find NTDDI_* macros
# elif defined(_WIN32_WINNT_WS03)
//Windows Server 2003 with SP1,
//Windows XP with SP2 _WIN32_WINNT_WS03 (0x0502)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WS03
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WS03
# elif defined(_WIN32_WINNT_WINXP)
//Windows Server 2003, Windows XP _WIN32_WINNT_WINXP (0x0501)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WINXP
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION NTDDI_WINXP
# elif defined(_WIN32_WINNT_WIN2K)
//Windows 2000 _WIN32_WINNT_WIN2K (0x0500)
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT _WIN32_WINNT_WIN2K
# elif defined(WINVER)
// fail back on WINVER
# ifdef _WIN32_WINNT
# undef _WIN32_WINNT
# endif
# define _WIN32_WINNT WINVER
# elif !defined(_WIN32_WINNT)
// last resort = Win XP, SP2 is minimum supported
# define _WIN32_WINNT 0x0502
# ifdef NTDDI_VERSION
# undef NTDDI_VERSION
# endif
# define NTDDI_VERSION 0x05020000
# endif
#endif // POCO_FORCE_MIN_WINDOWS_OS_SUPPORT
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
// Verify that we're built with the multithreaded
// versions of the runtime libraries
#if defined(_MSC_VER) && !defined(_MT)
# error Must compile with /MD, /MDd, /MT or /MTd
#endif
// Check debug/release settings consistency
#if defined(NDEBUG) && defined(_DEBUG)
# error Inconsistent build settings (check for /MD[d])
#endif
#if (_MSC_VER >= 1300) && (_MSC_VER < 1400) // Visual Studio 2003, MSVC++ 7.1
# define POCO_MSVS_VERSION 2003
# define POCO_MSVC_VERSION 71
#elif (_MSC_VER >= 1400) && (_MSC_VER < 1500) // Visual Studio 2005, MSVC++ 8.0
# define POCO_MSVS_VERSION 2005
# define POCO_MSVC_VERSION 80
#elif (_MSC_VER >= 1500) && (_MSC_VER < 1600) // Visual Studio 2008, MSVC++ 9.0
# define POCO_MSVS_VERSION 2008
# define POCO_MSVC_VERSION 90
#elif (_MSC_VER >= 1600) && (_MSC_VER < 1700) // Visual Studio 2010, MSVC++ 10.0
# define POCO_MSVS_VERSION 2010
# define POCO_MSVC_VERSION 100
#elif (_MSC_VER >= 1700) && (_MSC_VER < 1800) // Visual Studio 2012, MSVC++ 11.0
# define POCO_MSVS_VERSION 2012
# define POCO_MSVC_VERSION 110
#elif (_MSC_VER >= 1800) && (_MSC_VER < 1900) // Visual Studio 2013, MSVC++ 12.0
# define POCO_MSVS_VERSION 2013
# define POCO_MSVC_VERSION 120
#elif (_MSC_VER >= 1900) && (_MSC_VER < 1910) // Visual Studio 2015, MSVC++ 14.0
# define POCO_MSVS_VERSION 2015
# define POCO_MSVC_VERSION 140
#elif (_MSC_VER >= 1910) && (_MSC_VER < 2000) // Visual Studio 2017, MSVC++ 14.1
# define POCO_MSVS_VERSION 2017
# define POCO_MSVC_VERSION 141
#endif
// Unicode Support
#if defined(UNICODE) && !defined(POCO_WIN32_UTF8)
# define POCO_WIN32_UTF8
#endif
#if !defined(POCO_WIN32_UTF8)
# pragma message("Compiling POCO on Windows without #define POCO_WIN32_UTF8 is deprecated.")
#endif
// Turn off some annoying warnings
#if defined(_MSC_VER)
# pragma warning(disable : 4018) // signed/unsigned comparison
# pragma warning(disable : 4250) // VC++ 11.0: inheriting from std stream classes produces C4250 warning; \
// see <http://connect.microsoft.com/VisualStudio/feedback/details/733720/inheriting-from-std-fstream-produces-c4250-warning>
# pragma warning(disable : 4251) // ... needs to have dll-interface warning
# pragma warning(disable : 4275) // non dll-interface class 'std::exception' used as base for dll-interface class 'Poco::Exception'
# pragma warning( \
disable : 4344) // behavior change: use of explicit template arguments results in call to '...' but '...' is a better match
# pragma warning(disable : 4351) // new behavior: elements of array '...' will be default initialized
# pragma warning(disable : 4355) // 'this' : used in base member initializer list
# pragma warning(disable : 4675) // resolved overload was found by argument-dependent lookup
# pragma warning(disable : 4996) // VC++ 8.0 deprecation warnings
#endif
// Enable C++11 support for VS 2010 and newer
#if defined(_MSC_VER) && (_MSC_VER >= 1700) && !defined(POCO_ENABLE_CPP11)
# define POCO_ENABLE_CPP11
#endif
#if defined(__INTEL_COMPILER)
# pragma warning(disable : 1738) // base class dllexport/dllimport specification differs from that of the derived class
# pragma warning(disable : 1478) // function ... was declared "deprecated"
# pragma warning(disable : 1744) // field of class type without a DLL interface used in a class with a DLL interface
#endif
#endif // Foundation_Platform_WIN32_INCLUDED

View File

@ -21,17 +21,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# if defined(_WIN32_WCE)
# include "Process_WINCE.h"
# else
# include "Poco/Process_WIN32U.h"
# endif
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/Process_WIN32.h"
#elif defined(POCO_VXWORKS)
# include "Poco/Process_VX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
#if defined(POCO_OS_FAMILY_UNIX)
# include "Poco/Process_UNIX.h"
#endif

View File

@ -1,79 +0,0 @@
//
// Process_VX.h
//
// Library: Foundation
// Package: Processes
// Module: Process
//
// Definition of the ProcessImpl class for VxWorks.
//
// Copyright (c) 2004-20011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Process_VX_INCLUDED
#define Foundation_Process_VX_INCLUDED
#include <map>
#include <vector>
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#undef PID
namespace Poco
{
class Pipe;
class Foundation_API ProcessHandleImpl : public RefCountedObject
{
public:
ProcessHandleImpl(int pid);
~ProcessHandleImpl();
int id() const;
int wait() const;
private:
int _pid;
};
class Foundation_API ProcessImpl
{
public:
typedef int PIDImpl;
typedef std::vector<std::string> ArgsImpl;
typedef std::map<std::string, std::string> EnvImpl;
static PIDImpl idImpl();
static void timesImpl(long & userTime, long & kernelTime);
static ProcessHandleImpl * launchImpl(
const std::string & command,
const ArgsImpl & args,
const std::string & initialDirectory,
Pipe * inPipe,
Pipe * outPipe,
Pipe * errPipe,
const EnvImpl & env);
static void killImpl(ProcessHandleImpl & handle);
static void killImpl(PIDImpl pid);
static bool isRunningImpl(const ProcessHandleImpl & handle);
static bool isRunningImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
};
} // namespace Poco
#endif // Foundation_Process_UNIX_INCLUDED

View File

@ -1,84 +0,0 @@
//
// Process_WIN32.h
//
// Library: Foundation
// Package: Processes
// Module: Process
//
// Definition of the ProcessImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Process_WIN32_INCLUDED
#define Foundation_Process_WIN32_INCLUDED
#include <map>
#include <vector>
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Pipe;
class Foundation_API ProcessHandleImpl : public RefCountedObject
{
public:
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
void closeHandle();
private:
HANDLE _hProcess;
UInt32 _pid;
ProcessHandleImpl(const ProcessHandleImpl &);
ProcessHandleImpl & operator=(const ProcessHandleImpl &);
};
class Foundation_API ProcessImpl
{
public:
typedef UInt32 PIDImpl;
typedef std::vector<std::string> ArgsImpl;
typedef std::map<std::string, std::string> EnvImpl;
static PIDImpl idImpl();
static void timesImpl(long & userTime, long & kernelTime);
static ProcessHandleImpl * launchImpl(
const std::string & command,
const ArgsImpl & args,
const std::string & initialDirectory,
Pipe * inPipe,
Pipe * outPipe,
Pipe * errPipe,
const EnvImpl & env);
static void killImpl(ProcessHandleImpl & handle);
static void killImpl(PIDImpl pid);
static bool isRunningImpl(const ProcessHandleImpl & handle);
static bool isRunningImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);
};
} // namespace Poco
#endif // Foundation_Process_WIN32_INCLUDED

View File

@ -1,84 +0,0 @@
//
// Process_WIN32U.h
//
// Library: Foundation
// Package: Processes
// Module: Process
//
// Definition of the ProcessImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Process_WIN32U_INCLUDED
#define Foundation_Process_WIN32U_INCLUDED
#include <map>
#include <vector>
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Pipe;
class Foundation_API ProcessHandleImpl : public RefCountedObject
{
public:
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
void closeHandle();
private:
HANDLE _hProcess;
UInt32 _pid;
ProcessHandleImpl(const ProcessHandleImpl &);
ProcessHandleImpl & operator=(const ProcessHandleImpl &);
};
class Foundation_API ProcessImpl
{
public:
typedef UInt32 PIDImpl;
typedef std::vector<std::string> ArgsImpl;
typedef std::map<std::string, std::string> EnvImpl;
static PIDImpl idImpl();
static void timesImpl(long & userTime, long & kernelTime);
static ProcessHandleImpl * launchImpl(
const std::string & command,
const ArgsImpl & args,
const std::string & initialDirectory,
Pipe * inPipe,
Pipe * outPipe,
Pipe * errPipe,
const EnvImpl & env);
static void killImpl(ProcessHandleImpl & handle);
static void killImpl(PIDImpl pid);
static bool isRunningImpl(const ProcessHandleImpl & handle);
static bool isRunningImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);
};
} // namespace Poco
#endif // Foundation_Process_WIN32U_INCLUDED

View File

@ -1,84 +0,0 @@
//
// Process_WINCE.h
//
// Library: Foundation
// Package: Processes
// Module: Process
//
// Definition of the ProcessImpl class for WIN32.
//
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Process_WINCE_INCLUDED
#define Foundation_Process_WINCE_INCLUDED
#include <map>
#include <vector>
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Pipe;
class Foundation_API ProcessHandleImpl : public RefCountedObject
{
public:
ProcessHandleImpl(HANDLE _hProcess, UInt32 pid);
~ProcessHandleImpl();
UInt32 id() const;
HANDLE process() const;
int wait() const;
void closeHandle();
private:
HANDLE _hProcess;
UInt32 _pid;
ProcessHandleImpl(const ProcessHandleImpl &);
ProcessHandleImpl & operator=(const ProcessHandleImpl &);
};
class Foundation_API ProcessImpl
{
public:
typedef UInt32 PIDImpl;
typedef std::vector<std::string> ArgsImpl;
typedef std::map<std::string, std::string> EnvImpl;
static PIDImpl idImpl();
static void timesImpl(long & userTime, long & kernelTime);
static ProcessHandleImpl * launchImpl(
const std::string & command,
const ArgsImpl & args,
const std::string & initialDirectory,
Pipe * inPipe,
Pipe * outPipe,
Pipe * errPipe,
const EnvImpl & env);
static void killImpl(ProcessHandleImpl & handle);
static void killImpl(PIDImpl pid);
static bool isRunningImpl(const ProcessHandleImpl & handle);
static bool isRunningImpl(PIDImpl pid);
static void requestTerminationImpl(PIDImpl pid);
static std::string terminationEventName(PIDImpl pid);
};
} // namespace Poco
#endif // Foundation_Process_WINCE_INCLUDED

View File

@ -22,16 +22,8 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# if defined(_WIN32_WCE)
# include "Poco/RWLock_WINCE.h"
# else
# include "Poco/RWLock_WIN32.h"
# endif
#elif POCO_OS == POCO_OS_ANDROID
#if POCO_OS == POCO_OS_ANDROID
# include "Poco/RWLock_Android.h"
#elif defined(POCO_VXWORKS)
# include "Poco/RWLock_VX.h"
#else
# include "Poco/RWLock_POSIX.h"
#endif

View File

@ -1,91 +0,0 @@
//
// RWLock_VX.h
//
// Library: Foundation
// Package: Threading
// Module: RWLock
//
// Definition of the RWLockImpl class for POSIX Threads (VxWorks).
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_RWLock_VX_INCLUDED
#define Foundation_RWLock_VX_INCLUDED
#include <errno.h>
#include <pthread.h>
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API RWLockImpl
{
protected:
RWLockImpl();
~RWLockImpl();
void readLockImpl();
bool tryReadLockImpl();
void writeLockImpl();
bool tryWriteLockImpl();
void unlockImpl();
private:
pthread_mutex_t _mutex;
};
//
// inlines
//
inline void RWLockImpl::readLockImpl()
{
if (pthread_mutex_lock(&_mutex))
throw SystemException("cannot lock mutex");
}
inline bool RWLockImpl::tryReadLockImpl()
{
int rc = pthread_mutex_trylock(&_mutex);
if (rc == 0)
return true;
else if (rc == EBUSY)
return false;
else
throw SystemException("cannot lock mutex");
}
inline void RWLockImpl::writeLockImpl()
{
readLockImpl();
}
inline bool RWLockImpl::tryWriteLockImpl()
{
return tryReadLockImpl();
}
inline void RWLockImpl::unlockImpl()
{
if (pthread_mutex_unlock(&_mutex))
throw SystemException("cannot unlock mutex");
}
} // namespace Poco
#endif // Foundation_RWLock_VX_INCLUDED

View File

@ -1,58 +0,0 @@
//
// RWLock_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: RWLock
//
// Definition of the RWLockImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_RWLock_WIN32_INCLUDED
#define Foundation_RWLock_WIN32_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API RWLockImpl
{
protected:
RWLockImpl();
~RWLockImpl();
void readLockImpl();
bool tryReadLockImpl();
void writeLockImpl();
bool tryWriteLockImpl();
void unlockImpl();
private:
void addWriter();
void removeWriter();
DWORD tryReadLockOnce();
HANDLE _mutex;
HANDLE _readEvent;
HANDLE _writeEvent;
unsigned _readers;
unsigned _writersWaiting;
unsigned _writers;
};
} // namespace Poco
#endif // Foundation_RWLock_WIN32_INCLUDED

View File

@ -1,62 +0,0 @@
//
// RWLock_WINCE.h
//
// Library: Foundation
// Package: Threading
// Module: RWLock
//
// Definition of the RWLockImpl class for WINCE.
//
// Copyright (c) 2009-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_RWLock_WINCE_INCLUDED
#define Foundation_RWLock_WINCE_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API RWLockImpl
/// This implementation is based on the one from Stone Steps Inc,
/// licensed under the BSD license.
/// http://forums.stonesteps.ca/thread.asp?t=105
///
/// Note that with this implementation, writers always take
/// precedence over readers.
{
protected:
RWLockImpl();
~RWLockImpl();
void readLockImpl();
bool tryReadLockImpl(DWORD timeout = 1);
void writeLockImpl();
bool tryWriteLockImpl(DWORD timeout = 1);
void unlockImpl();
private:
DWORD _readerCount;
DWORD _readerWaiting;
DWORD _writerCount;
DWORD _writerWaiting;
HANDLE _readerGreen;
HANDLE _writerGreen;
CRITICAL_SECTION _cs;
bool _writeLock;
};
} // namespace Poco
#endif // Foundation_RWLock_WINCE_INCLUDED

View File

@ -22,13 +22,7 @@
#include "Poco/Foundation.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/Semaphore_WIN32.h"
#elif defined(POCO_VXWORKS)
# include "Poco/Semaphore_VX.h"
#else
# include "Poco/Semaphore_POSIX.h"
#endif
namespace Poco

View File

@ -1,57 +0,0 @@
//
// Semaphore_VX.h
//
// Library: Foundation
// Package: Threading
// Module: Semaphore
//
// Definition of the SemaphoreImpl class for VxWorks.
//
// Copyright (c) 2004-20011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Semaphore_VX_INCLUDED
#define Foundation_Semaphore_VX_INCLUDED
#include <semLib.h>
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
namespace Poco
{
class Foundation_API SemaphoreImpl
{
protected:
SemaphoreImpl(int n, int max);
~SemaphoreImpl();
void setImpl();
void waitImpl();
bool waitImpl(long milliseconds);
private:
SEM_ID _sem;
};
//
// inlines
//
inline void SemaphoreImpl::setImpl()
{
if (semGive(_sem) != OK)
throw SystemException("cannot signal semaphore");
}
} // namespace Poco
#endif // Foundation_Semaphore_VX_INCLUDED

View File

@ -1,59 +0,0 @@
//
// Semaphore_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: Semaphore
//
// Definition of the SemaphoreImpl class for WIN32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Semaphore_WIN32_INCLUDED
#define Foundation_Semaphore_WIN32_INCLUDED
#include "Poco/Exception.h"
#include "Poco/Foundation.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API SemaphoreImpl
{
protected:
SemaphoreImpl(int n, int max);
~SemaphoreImpl();
void setImpl();
void waitImpl();
bool waitImpl(long milliseconds);
private:
HANDLE _sema;
};
//
// inlines
//
inline void SemaphoreImpl::setImpl()
{
if (!ReleaseSemaphore(_sema, 1, NULL))
{
throw SystemException("cannot signal semaphore");
}
}
} // namespace Poco
#endif // Foundation_Semaphore_WIN32_INCLUDED

View File

@ -23,14 +23,8 @@
#if defined(hpux) || defined(_hpux)
# include "Poco/SharedLibrary_HPUX.h"
#elif defined(POCO_VXWORKS)
# include "Poco/SharedLibrary_VX.h"
#elif defined(POCO_OS_FAMILY_UNIX)
# include "Poco/SharedLibrary_UNIX.h"
#elif defined(POCO_OS_FAMILY_WINDOWS) && defined(POCO_WIN32_UTF8)
# include "Poco/SharedLibrary_WIN32U.h"
#elif defined(POCO_OS_FAMILY_WINDOWS)
# include "Poco/SharedLibrary_WIN32.h"
#endif

View File

@ -1,53 +0,0 @@
//
// SharedLibrary_HPUX.h
//
// Library: Foundation
// Package: SharedLibrary
// Module: SharedLibrary
//
// Definition of the SharedLibraryImpl class for HP-UX.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_SharedLibrary_HPUX_INCLUDED
#define Foundation_SharedLibrary_HPUX_INCLUDED
#include <dl.h>
#include "Poco/Foundation.h"
#include "Poco/Mutex.h"
namespace Poco
{
class Foundation_API SharedLibraryImpl
{
protected:
SharedLibraryImpl();
~SharedLibraryImpl();
void loadImpl(const std::string & path, int flags);
void unloadImpl();
bool isLoadedImpl() const;
void * findSymbolImpl(const std::string & name);
const std::string & getPathImpl() const;
static std::string suffixImpl();
static bool setSearchPathImpl(const std::string & path);
private:
std::string _path;
shl_t _handle;
static FastMutex _mutex;
};
} // namespace Poco
#endif // Foundation_SharedLibrary_HPUX_INCLUDED

View File

@ -1,53 +0,0 @@
//
// SharedLibrary_VX.h
//
// Library: Foundation
// Package: SharedLibrary
// Module: SharedLibrary
//
// Definition of the SharedLibraryImpl class for VxWorks.
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_SharedLibrary_VX_INCLUDED
#define Foundation_SharedLibrary_VX_INCLUDED
#include <moduleLib.h>
#include "Poco/Foundation.h"
#include "Poco/Mutex.h"
namespace Poco
{
class Foundation_API SharedLibraryImpl
{
protected:
SharedLibraryImpl();
~SharedLibraryImpl();
void loadImpl(const std::string & path, int flags);
void unloadImpl();
bool isLoadedImpl() const;
void * findSymbolImpl(const std::string & name);
const std::string & getPathImpl() const;
static std::string suffixImpl();
static bool setSearchPathImpl(const std::string & path);
private:
std::string _path;
MODULE_ID _moduleId;
static FastMutex _mutex;
};
} // namespace Poco
#endif // Foundation_SharedLibrary_VX_INCLUDED

View File

@ -1,52 +0,0 @@
//
// SharedLibrary_WIN32.h
//
// Library: Foundation
// Package: SharedLibrary
// Module: SharedLibrary
//
// Definition of the SharedLibraryImpl class for Win32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_SharedLibrary_WIN32_INCLUDED
#define Foundation_SharedLibrary_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Mutex.h"
namespace Poco
{
class Foundation_API SharedLibraryImpl
{
protected:
SharedLibraryImpl();
~SharedLibraryImpl();
void loadImpl(const std::string & path, int flags);
void unloadImpl();
bool isLoadedImpl() const;
void * findSymbolImpl(const std::string & name);
const std::string & getPathImpl() const;
static std::string suffixImpl();
static bool setSearchPathImpl(const std::string & path);
private:
std::string _path;
void * _handle;
static FastMutex _mutex;
};
} // namespace Poco
#endif // Foundation_SharedLibrary_WIN32_INCLUDED

View File

@ -1,52 +0,0 @@
//
// SharedLibrary_WIN32U.h
//
// Library: Foundation
// Package: SharedLibrary
// Module: SharedLibrary
//
// Definition of the SharedLibraryImpl class for Win32.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_SharedLibrary_WIN32U_INCLUDED
#define Foundation_SharedLibrary_WIN32U_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Mutex.h"
namespace Poco
{
class Foundation_API SharedLibraryImpl
{
protected:
SharedLibraryImpl();
~SharedLibraryImpl();
void loadImpl(const std::string & path, int flags);
void unloadImpl();
bool isLoadedImpl() const;
void * findSymbolImpl(const std::string & name);
const std::string & getPathImpl() const;
static std::string suffixImpl();
static bool setSearchPathImpl(const std::string & path);
private:
std::string _path;
void * _handle;
static FastMutex _mutex;
};
} // namespace Poco
#endif // Foundation_SharedLibrary_WIN32U_INCLUDED

View File

@ -1,104 +0,0 @@
//
// SharedMemoryImpl.h
//
// Library: Foundation
// Package: Processes
// Module: SharedMemoryImpl
//
// Definition of the SharedMemoryImpl class.
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_SharedMemoryImpl_INCLUDED
#define Foundation_SharedMemoryImpl_INCLUDED
#include "Poco/Poco.h"
#include "Poco/RefCountedObject.h"
#include "Poco/SharedMemory.h"
namespace Poco
{
class Foundation_API SharedMemoryImpl : public RefCountedObject
/// Shared memory implementation for Windows platforms.
{
public:
SharedMemoryImpl(const std::string & name, std::size_t size, SharedMemory::AccessMode mode, const void * addrHint, bool server);
/// Creates or connects to a shared memory object with the given name.
///
/// For maximum portability, name should be a valid Unix filename and not
/// contain any slashes or backslashes.
///
/// An address hint can be passed to the system, specifying the desired
/// start address of the shared memory area. Whether the hint
/// is actually honored is, however, up to the system. Windows platform
/// will generally ignore the hint.
SharedMemoryImpl(const Poco::File & file, SharedMemory::AccessMode mode, const void * addrHint);
/// Maps the entire contents of file into a shared memory segment.
///
/// An address hint can be passed to the system, specifying the desired
/// start address of the shared memory area. Whether the hint
/// is actually honored is, however, up to the system. Windows platform
/// will generally ignore the hint.
char * begin() const;
/// Returns the begin address of the SharedMemory segment. Will be null for illegal segments.
char * end() const;
/// Points past the last byte of the end address of the SharedMemory segment. Will be null for illegal segments.
protected:
void map();
/// Maps the shared memory object.
void unmap();
/// Unmaps the shared memory object.
void close();
/// Releases the handle for the shared memory segment.
~SharedMemoryImpl();
/// Destroys the SharedMemoryImpl.
private:
SharedMemoryImpl();
SharedMemoryImpl(const SharedMemoryImpl &);
SharedMemoryImpl & operator=(const SharedMemoryImpl &);
std::string _name;
HANDLE _memHandle;
HANDLE _fileHandle;
DWORD _size;
DWORD _mode;
char * _address;
};
//
// inlines
//
inline char * SharedMemoryImpl::begin() const
{
return _address;
}
inline char * SharedMemoryImpl::end() const
{
return _address + _size;
}
} // namespace Poco
#endif // Foundation_SharedMemoryImpl_INCLUDED

View File

@ -73,12 +73,6 @@
#if !defined(POCO_IOS_INIT_HACK)
// Microsoft Visual Studio with Dinkumware STL (but not STLport)
# if defined(_MSC_VER) && (!defined(_STLP_MSVC) || defined(_STLP_NO_OWN_IOSTREAMS))
# define POCO_IOS_INIT_HACK 1
// QNX with Dinkumware but not GNU C++ Library
# elif defined(__QNX__) && !defined(__GLIBCPP__)
# define POCO_IOS_INIT_HACK 1
# endif
#endif

View File

@ -429,13 +429,7 @@ S translateInPlace(S & str, const typename S::value_type * from, const typename
poco_check_ptr(from);
poco_check_ptr(to);
str = translate(str, S(from), S(to));
#if defined(__SUNPRO_CC)
// Fix around the RVO bug in SunStudio 12.4
S ret(str);
return ret;
#else
return str;
#endif
}

View File

@ -23,17 +23,7 @@
#include "Poco/Mutex.h"
#if defined(POCO_OS_FAMILY_WINDOWS)
# if defined(_WIN32_WCE)
# include "Poco/Thread_WINCE.h"
# else
# include "Poco/Thread_WIN32.h"
# endif
#elif defined(POCO_VXWORKS)
# include "Poco/Thread_VX.h"
#else
# include "Poco/Thread_POSIX.h"
#endif
namespace Poco

View File

@ -32,9 +32,6 @@
# include <sys/select.h>
#endif
#include <errno.h>
#if defined(POCO_VXWORKS)
# include <cstring>
#endif
namespace Poco
@ -116,11 +113,6 @@ private:
, started(false)
, joined(false)
{
#if defined(POCO_VXWORKS)
// This workaround is for VxWorks 5.x where
// pthread_init() won't properly initialize the thread.
std::memset(&thread, 0, sizeof(thread));
#endif
}
SharedPtr<Runnable> pRunnableTarget;

View File

@ -1,167 +0,0 @@
//
// Thread_VX.h
//
// Library: Foundation
// Package: Threading
// Module: Thread
//
// Definition of the ThreadImpl class for VxWorks tasks.
//
// Copyright (c) 2004-2011, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Thread_VX_INCLUDED
#define Foundation_Thread_VX_INCLUDED
#include <taskLib.h>
#include <taskVarLib.h>
#include "Poco/AutoPtr.h"
#include "Poco/Event.h"
#include "Poco/Foundation.h"
#include "Poco/RefCountedObject.h"
#include "Poco/Runnable.h"
#include "Poco/SignalHandler.h"
namespace Poco
{
class Foundation_API ThreadImpl
{
public:
typedef int TIDImpl;
typedef void (*Callable)(void *);
enum Priority
{
PRIO_LOWEST_IMPL,
PRIO_LOW_IMPL,
PRIO_NORMAL_IMPL,
PRIO_HIGH_IMPL,
PRIO_HIGHEST_IMPL
};
enum Policy
{
POLICY_DEFAULT_IMPL = 0
};
enum
{
DEFAULT_THREAD_STACK_SIZE = 65536
};
struct CallbackData : public RefCountedObject
{
CallbackData() : callback(0), pData(0) { }
Callable callback;
void * pData;
};
ThreadImpl();
~ThreadImpl();
TIDImpl tidImpl() const;
void setPriorityImpl(int prio);
int getPriorityImpl() const;
void setOSPriorityImpl(int prio, int policy = 0);
int getOSPriorityImpl() const;
static int getMinOSPriorityImpl(int policy);
static int getMaxOSPriorityImpl(int policy);
void setStackSizeImpl(int size);
int getStackSizeImpl() const;
void startImpl(Runnable & target);
void startImpl(Callable target, void * pData = 0);
void joinImpl();
bool joinImpl(long milliseconds);
bool isRunningImpl() const;
static void sleepImpl(long milliseconds);
static void yieldImpl();
static ThreadImpl * currentImpl();
static TIDImpl currentTidImpl();
protected:
static void runnableEntry(void * pThread, int, int, int, int, int, int, int, int, int);
static void callableEntry(void * pThread, int, int, int, int, int, int, int, int, int);
static int mapPrio(int prio);
static int reverseMapPrio(int osPrio);
struct ThreadData : public RefCountedObject
{
ThreadData()
: pRunnableTarget(0)
, pCallbackTarget(0)
, task(0)
, prio(PRIO_NORMAL_IMPL)
, osPrio(127)
, done(false)
, stackSize(POCO_THREAD_STACK_SIZE)
{
}
Runnable * pRunnableTarget;
AutoPtr<CallbackData> pCallbackTarget;
int task;
int prio;
int osPrio;
Event done;
int stackSize;
};
private:
AutoPtr<ThreadData> _pData;
static ThreadImpl * _pCurrent;
};
//
// inlines
//
inline int ThreadImpl::getPriorityImpl() const
{
return _pData->prio;
}
inline int ThreadImpl::getOSPriorityImpl() const
{
return _pData->osPrio;
}
inline bool ThreadImpl::isRunningImpl() const
{
return _pData->pRunnableTarget != 0 || (_pData->pCallbackTarget.get() != 0 && _pData->pCallbackTarget->callback != 0);
}
inline void ThreadImpl::yieldImpl()
{
taskDelay(0);
}
inline int ThreadImpl::getStackSizeImpl() const
{
return _pData->stackSize;
}
inline ThreadImpl::TIDImpl ThreadImpl::tidImpl() const
{
return _pData->task;
}
} // namespace Poco
#endif // Foundation_Thread_VX_INCLUDED

View File

@ -1,175 +0,0 @@
//
// Thread_WIN32.h
//
// Library: Foundation
// Package: Threading
// Module: Thread
//
// Definition of the ThreadImpl class for WIN32.
//
// Copyright (c) 2004-2009, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Thread_WIN32_INCLUDED
#define Foundation_Thread_WIN32_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Runnable.h"
#include "Poco/SharedPtr.h"
#include "Poco/UnWindows.h"
namespace Poco
{
class Foundation_API ThreadImpl
{
public:
typedef DWORD TIDImpl;
typedef void (*Callable)(void *);
#if defined(_DLL)
typedef DWORD(WINAPI * Entry)(LPVOID);
#else
typedef unsigned(__stdcall * Entry)(void *);
#endif
enum Priority
{
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
PRIO_LOW_IMPL = THREAD_PRIORITY_BELOW_NORMAL,
PRIO_NORMAL_IMPL = THREAD_PRIORITY_NORMAL,
PRIO_HIGH_IMPL = THREAD_PRIORITY_ABOVE_NORMAL,
PRIO_HIGHEST_IMPL = THREAD_PRIORITY_HIGHEST
};
enum Policy
{
POLICY_DEFAULT_IMPL = 0
};
ThreadImpl();
~ThreadImpl();
TIDImpl tidImpl() const;
void setPriorityImpl(int prio);
int getPriorityImpl() const;
void setOSPriorityImpl(int prio, int policy = 0);
int getOSPriorityImpl() const;
static int getMinOSPriorityImpl(int policy);
static int getMaxOSPriorityImpl(int policy);
void setStackSizeImpl(int size);
int getStackSizeImpl() const;
void startImpl(SharedPtr<Runnable> pTarget);
void joinImpl();
bool joinImpl(long milliseconds);
bool isRunningImpl() const;
static void sleepImpl(long milliseconds);
static void yieldImpl();
static ThreadImpl * currentImpl();
static TIDImpl currentTidImpl();
protected:
#if defined(_DLL)
static DWORD WINAPI runnableEntry(LPVOID pThread);
#else
static unsigned __stdcall runnableEntry(void * pThread);
#endif
void createImpl(Entry ent, void * pData);
void threadCleanup();
private:
class CurrentThreadHolder
{
public:
CurrentThreadHolder() : _slot(TlsAlloc())
{
if (_slot == TLS_OUT_OF_INDEXES)
throw SystemException("cannot allocate thread context key");
}
~CurrentThreadHolder() { TlsFree(_slot); }
ThreadImpl * get() const { return reinterpret_cast<ThreadImpl *>(TlsGetValue(_slot)); }
void set(ThreadImpl * pThread) { TlsSetValue(_slot, pThread); }
private:
DWORD _slot;
};
SharedPtr<Runnable> _pRunnableTarget;
HANDLE _thread;
DWORD _threadId;
int _prio;
int _stackSize;
static CurrentThreadHolder _currentThreadHolder;
};
//
// inlines
//
inline int ThreadImpl::getPriorityImpl() const
{
return _prio;
}
inline int ThreadImpl::getOSPriorityImpl() const
{
return _prio;
}
inline int ThreadImpl::getMinOSPriorityImpl(int /* policy */)
{
return PRIO_LOWEST_IMPL;
}
inline int ThreadImpl::getMaxOSPriorityImpl(int /* policy */)
{
return PRIO_HIGHEST_IMPL;
}
inline void ThreadImpl::sleepImpl(long milliseconds)
{
Sleep(DWORD(milliseconds));
}
inline void ThreadImpl::yieldImpl()
{
Sleep(0);
}
inline void ThreadImpl::setStackSizeImpl(int size)
{
_stackSize = size;
}
inline int ThreadImpl::getStackSizeImpl() const
{
return _stackSize;
}
inline ThreadImpl::TIDImpl ThreadImpl::tidImpl() const
{
return _threadId;
}
} // namespace Poco
#endif // Foundation_Thread_WIN32_INCLUDED

View File

@ -1,171 +0,0 @@
//
// Thread_WINCE.h
//
// Library: Foundation
// Package: Threading
// Module: Thread
//
// Definition of the ThreadImpl class for WIN32.
//
// Copyright (c) 2004-2010, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef Foundation_Thread_WINCE_INCLUDED
#define Foundation_Thread_WINCE_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/Runnable.h"
#include "Poco/SharedPtr.h"
#include "Poco/UnWindows.h"
#if !defined(TLS_OUT_OF_INDEXES) // Windows CE 5.x does not define this
# define TLS_OUT_OF_INDEXES 0xFFFFFFFF
#endif
namespace Poco
{
class Foundation_API ThreadImpl
{
public:
typedef DWORD TIDImpl;
typedef void (*Callable)(void *);
typedef DWORD(WINAPI * Entry)(LPVOID);
enum Priority
{
PRIO_LOWEST_IMPL = THREAD_PRIORITY_LOWEST,
PRIO_LOW_IMPL = THREAD_PRIORITY_BELOW_NORMAL,
PRIO_NORMAL_IMPL = THREAD_PRIORITY_NORMAL,
PRIO_HIGH_IMPL = THREAD_PRIORITY_ABOVE_NORMAL,
PRIO_HIGHEST_IMPL = THREAD_PRIORITY_HIGHEST
};
enum Policy
{
POLICY_DEFAULT_IMPL = 0
};
ThreadImpl();
~ThreadImpl();
TIDImpl tidImpl() const;
void setPriorityImpl(int prio);
int getPriorityImpl() const;
void setOSPriorityImpl(int prio, int policy = 0);
int getOSPriorityImpl() const;
static int getMinOSPriorityImpl(int policy);
static int getMaxOSPriorityImpl(int policy);
void setStackSizeImpl(int size);
int getStackSizeImpl() const;
void startImpl(SharedPtr<Runnable> pTarget);
void joinImpl();
bool joinImpl(long milliseconds);
bool isRunningImpl() const;
static void sleepImpl(long milliseconds);
static void yieldImpl();
static ThreadImpl * currentImpl();
static TIDImpl currentTidImpl();
protected:
static DWORD WINAPI runnableEntry(LPVOID pThread);
void createImpl(Entry ent, void * pData);
void threadCleanup();
private:
class CurrentThreadHolder
{
public:
CurrentThreadHolder() : _slot(TlsAlloc())
{
if (_slot == TLS_OUT_OF_INDEXES)
throw SystemException("cannot allocate thread context key");
}
~CurrentThreadHolder() { TlsFree(_slot); }
ThreadImpl * get() const { return reinterpret_cast<ThreadImpl *>(TlsGetValue(_slot)); }
void set(ThreadImpl * pThread) { TlsSetValue(_slot, pThread); }
private:
DWORD _slot;
};
SharedPtr<Runnable> _pRunnableTarget;
HANDLE _thread;
DWORD _threadId;
int _prio;
int _stackSize;
static CurrentThreadHolder _currentThreadHolder;
};
//
// inlines
//
inline int ThreadImpl::getPriorityImpl() const
{
return _prio;
}
inline int ThreadImpl::getOSPriorityImpl() const
{
return _prio;
}
inline int ThreadImpl::getMinOSPriorityImpl(int /* policy */)
{
return PRIO_LOWEST_IMPL;
}
inline int ThreadImpl::getMaxOSPriorityImpl(int /* policy */)
{
return PRIO_HIGHEST_IMPL;
}
inline void ThreadImpl::sleepImpl(long milliseconds)
{
Sleep(DWORD(milliseconds));
}
inline void ThreadImpl::yieldImpl()
{
Sleep(0);
}
inline void ThreadImpl::setStackSizeImpl(int size)
{
_stackSize = size;
}
inline int ThreadImpl::getStackSizeImpl() const
{
return _stackSize;
}
inline ThreadImpl::TIDImpl ThreadImpl::tidImpl() const
{
return _threadId;
}
} // namespace Poco
#endif // Foundation_Thread_WINCE_INCLUDED

View File

@ -140,10 +140,6 @@ public:
/// Since the timestamp has microsecond resolution,
/// the returned value is always 1000000.
#if defined(_WIN32)
static Timestamp fromFileTimeNP(UInt32 fileTimeLow, UInt32 fileTimeHigh);
void toFileTimeNP(UInt32 & fileTimeLow, UInt32 & fileTimeHigh) const;
#endif
private:
TimeVal _ts;

View File

@ -26,11 +26,7 @@ namespace Poco
{
#if defined(_MSC_VER)
# define POCO_TYPEWRAPPER_DEFAULTVALUE(T) TypeWrapper<T>::TYPE()
#else
# define POCO_TYPEWRAPPER_DEFAULTVALUE(T) typename TypeWrapper<T>::TYPE()
#endif
template <

Some files were not shown because too many files have changed in this diff Show More