fix indentation

This commit is contained in:
ale_bychuk
2015-03-08 22:04:29 +03:00
parent 662fbc861a
commit 3af35f548c
13 changed files with 1370 additions and 1367 deletions

View File

@@ -46,13 +46,13 @@ class ThreadLocalStorage;
class Foundation_API Thread: private ThreadImpl
/// This class implements a platform-independent
/// wrapper to an operating system thread.
///
/// Every Thread object gets a unique (within
/// its process) numeric thread ID.
/// Furthermore, a thread can be assigned a name.
/// The name of a thread can be changed at any time.
/// This class implements a platform-independent
/// wrapper to an operating system thread.
///
/// Every Thread object gets a unique (within
/// its process) numeric thread ID.
/// Furthermore, a thread can be assigned a name.
/// The name of a thread can be changed at any time.
{
public:
typedef ThreadImpl::TIDImpl TID;

View File

@@ -127,11 +127,11 @@ private:
started(false),
joined(false)
{
#if defined(POCO_VXWORKS)
#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
#endif
}
SharedPtr<Runnable> pRunnableTarget;

View File

@@ -36,9 +36,9 @@ public:
typedef void (*Callable)(void*);
#if defined(_DLL)
typedef DWORD (WINAPI *Entry)(LPVOID);
typedef DWORD (WINAPI* Entry)(LPVOID);
#else
typedef unsigned (__stdcall *Entry)(void*);
typedef unsigned (__stdcall* Entry)(void*);
#endif
enum Priority

View File

@@ -39,7 +39,7 @@ class Foundation_API ThreadImpl
public:
typedef DWORD TIDImpl;
typedef void (*Callable)(void*);
typedef DWORD (WINAPI *Entry)(LPVOID);
typedef DWORD (WINAPI* Entry)(LPVOID);
enum Priority
{

View File

@@ -39,11 +39,10 @@
// Block SIGPIPE in main thread.
//
#if defined(POCO_OS_FAMILY_UNIX) && !defined(POCO_VXWORKS)
namespace
namespace {
class SignalBlocker
{
class SignalBlocker
{
public:
public:
SignalBlocker()
{
sigset_t sset;
@@ -54,9 +53,9 @@ namespace
~SignalBlocker()
{
}
};
};
static SignalBlocker signalBlocker;
static SignalBlocker signalBlocker;
}
#endif
@@ -64,16 +63,15 @@ namespace
#if defined(POCO_POSIX_DEBUGGER_THREAD_NAMES)
namespace
namespace {
void setThreadName(pthread_t thread, const char* threadName)
{
void setThreadName(pthread_t thread, const char* threadName)
{
# if (POCO_OS == POCO_OS_MAC_OS_X)
pthread_setname_np(threadName); // __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_2)
# else
pthread_setname_np(thread, threadName);
# endif
}
}
}
@@ -109,7 +107,8 @@ void ThreadImpl::setPriorityImpl(int prio)
_pData->policy = SCHED_OTHER;
if (isRunningImpl())
{
struct sched_param par; struct MyStruct
struct sched_param par;
struct MyStruct
{
};
@@ -173,7 +172,7 @@ void ThreadImpl::setStackSizeImpl(int size)
#if defined(POCO_OS_FAMILY_BSD)
// we must round up to a multiple of the memory page size
const int STACK_PAGE_SIZE = 4096;
size = ((size + STACK_PAGE_SIZE - 1)/STACK_PAGE_SIZE)*STACK_PAGE_SIZE;
size = ((size + STACK_PAGE_SIZE - 1) / STACK_PAGE_SIZE) * STACK_PAGE_SIZE;
#endif
#if !defined(POCO_ANDROID)
if (size < PTHREAD_STACK_MIN)
@@ -220,9 +219,10 @@ void ThreadImpl::setAffinityImpl(unsigned cpu)
yieldImpl();
}
unsigned ThreadImpl::getAffinityImpl() const {
unsigned cpuSet = 0;
unsigned cpuCount = Environment::processorCount();
unsigned ThreadImpl::getAffinityImpl() const
{
unsigned cpuSet = 0;
unsigned cpuCount = Environment::processorCount();
#if defined (POCO_OS_FAMILY_UNIX) && POCO_OS != POCO_OS_MAC_OS_X
#ifdef HAVE_PTHREAD_SETAFFINITY_NP
cpu_set_t cpuset;
@@ -234,8 +234,10 @@ unsigned cpuCount = Environment::processorCount();
if (pthread_getaffinity_np(_pData->thread, &cpuset) != 0)
throw SystemException("Failed to get affinity", errno);
#endif
for (unsigned i = 0; i < cpuCount; i++) {
if (CPU_ISSET(i, &cpuset)) {
for (unsigned i = 0; i < cpuCount; i++)
{
if (CPU_ISSET(i, &cpuset))
{
cpuSet = i;
break;
}
@@ -255,7 +257,8 @@ unsigned cpuCount = Environment::processorCount();
(thread_policy_t)&policy,
&count,
&get_default);
if (ret != KERN_SUCCESS) {
if (ret != KERN_SUCCESS)
{
throw SystemException("Failed to get affinity", errno);
}
cpuSet = policy.affinity_tag;
@@ -357,16 +360,16 @@ void ThreadImpl::sleepImpl(long milliseconds)
// This is specific to DECThreads
struct timespec interval;
interval.tv_sec = milliseconds / 1000;
interval.tv_nsec = (milliseconds % 1000)*1000000;
interval.tv_nsec = (milliseconds % 1000) * 1000000;
pthread_delay_np(&interval);
#elif POCO_OS == POCO_OS_LINUX || POCO_OS == POCO_OS_MAC_OS_X || POCO_OS == POCO_OS_QNX || POCO_OS == POCO_OS_VXWORKS
Poco::Timespan remainingTime(1000*Poco::Timespan::TimeDiff(milliseconds));
Poco::Timespan remainingTime(1000 * Poco::Timespan::TimeDiff(milliseconds));
int rc;
do
{
struct timespec ts;
ts.tv_sec = (long) remainingTime.totalSeconds();
ts.tv_nsec = (long) remainingTime.useconds()*1000;
ts.tv_nsec = (long) remainingTime.useconds() * 1000;
Poco::Timestamp start;
rc = ::nanosleep(&ts, 0);
if (rc < 0 && errno == EINTR)
@@ -382,7 +385,7 @@ void ThreadImpl::sleepImpl(long milliseconds)
while (remainingTime > 0 && rc < 0 && errno == EINTR);
if (rc < 0 && remainingTime > 0) throw Poco::SystemException("Thread::sleep(): nanosleep() failed");
#else
Poco::Timespan remainingTime(1000*Poco::Timespan::TimeDiff(milliseconds));
Poco::Timespan remainingTime(1000 * Poco::Timespan::TimeDiff(milliseconds));
int rc;
do
{
@@ -458,11 +461,11 @@ int ThreadImpl::mapPrio(int prio, int policy)
case PRIO_LOWEST_IMPL:
return pmin;
case PRIO_LOW_IMPL:
return pmin + (pmax - pmin)/4;
return pmin + (pmax - pmin) / 4;
case PRIO_NORMAL_IMPL:
return pmin + (pmax - pmin)/2;
return pmin + (pmax - pmin) / 2;
case PRIO_HIGH_IMPL:
return pmin + 3*(pmax - pmin)/4;
return pmin + 3 * (pmax - pmin) / 4;
case PRIO_HIGHEST_IMPL:
return pmax;
default:
@@ -478,7 +481,7 @@ int ThreadImpl::reverseMapPrio(int prio, int policy)
{
int pmin = getMinOSPriorityImpl(policy);
int pmax = getMaxOSPriorityImpl(policy);
int normal = pmin + (pmax - pmin)/2;
int normal = pmin + (pmax - pmin) / 2;
if (prio == pmax)
return PRIO_HIGHEST_IMPL;
if (prio > normal)

View File

@@ -23,26 +23,25 @@
#if defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
namespace
namespace {
/// See <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>
/// and <http://blogs.msdn.com/b/stevejs/archive/2005/12/19/505815.aspx> for
/// more information on the code below.
const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
/// See <http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx>
/// and <http://blogs.msdn.com/b/stevejs/archive/2005/12/19/505815.aspx> for
/// more information on the code below.
const DWORD MS_VC_EXCEPTION = 0x406D1388;
#pragma pack(push,8)
typedef struct tagTHREADNAME_INFO
{
DWORD dwType; // Must be 0x1000.
LPCSTR szName; // Pointer to name (in user addr space).
DWORD dwThreadID; // Thread ID (-1=caller thread).
DWORD dwFlags; // Reserved for future use, must be zero.
} THREADNAME_INFO;
#pragma pack(pop)
} THREADNAME_INFO;
#pragma pack(pop)
void setThreadName(DWORD dwThreadID, const char* threadName)
{
void setThreadName(DWORD dwThreadID, const char* threadName)
{
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = threadName;
@@ -56,7 +55,7 @@ namespace
__except (EXCEPTION_CONTINUE_EXECUTION)
{
}
}
}
}
@@ -107,12 +106,14 @@ void ThreadImpl::setAffinityImpl(unsigned cpu)
{
DWORD mask = 1;
mask <<= cpu;
if (SetThreadAffinityMask(_thread, mask) == 0) {
if (SetThreadAffinityMask(_thread, mask) == 0)
{
throw SystemException("Failed to set affinity");
}
}
unsigned ThreadImpl::getAffinityImpl() const {
unsigned ThreadImpl::getAffinityImpl() const
{
throw Poco::NotImplementedException("Get thread affinity not supported on this system");
}

View File

@@ -20,7 +20,6 @@
#include "Poco/Timestamp.h"
#include "Poco/Timespan.h"
#include "Poco/Environment.h"
//#include <iostream>
#if defined(__sun) && defined(__SVR4) && !defined(__EXTENSIONS__)
#define __EXTENSIONS__
#endif

View File

@@ -8,15 +8,15 @@ rm -rf cmake-build
mkdir cmake-build
cd cmake-build
cmake ../. -DCMAKE_BUILD_TYPE=Debug $1 $2 $3 $4 $5
make -j3
make install
cmake ../. -DCMAKE_INSTALL_PREFIX=/opt/devel -DCMAKE_BUILD_TYPE=Debug -DENABLE_TESTS=ON -G "Sublime Text 2 - Unix Makefiles" $1 $2 $3 $4 $5
make -j8
sudo make install
rm -rf CMakeCache.txt
#rm -rf CMakeCache.txt
cmake ../. -DCMAKE_BUILD_TYPE=Release $1 $2 $3 $4 $5
make -j3
make install
#cmake ../. -DCMAKE_INSTALL_PREFIX=/opt/devel -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTS=ON $1 $2 $3 $4 $5
#make -j8
#sudo make install
cd ..