pylon/ThreadPriority.h#
Namespaces#
Name |
---|
Pylon Contains definitions of pylon types. |
Source code#
//-----------------------------------------------------------------------------
// Basler pylon SDK
// Copyright (c) 2006-2022 Basler AG
// http://www.baslerweb.com
//-----------------------------------------------------------------------------
#ifndef __THREADPRIORITY_H__
#define __THREADPRIORITY_H__
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <pylon/Platform.h>
#ifdef _MSC_VER
# pragma pack(push, PYLON_PACKING)
#endif /* _MSC_VER */
#include "PylonBase.h"
namespace Pylon
{
#if defined(PYLON_WIN_BUILD)
typedef HANDLE THREADHANDLE;
#elif defined(PYLON_HAS_POSIX_THREADS)
typedef pthread_t THREADHANDLE;
#else
# error Platform not supported.
#endif
void PYLONBASE_API GetRTThreadPriorityCapabilities( int& prioMin, int& prioMax );
int PYLONBASE_API GetRTThreadPriority( THREADHANDLE thread );
void PYLONBASE_API SetRTThreadPriority( THREADHANDLE thread, int priority );
inline THREADHANDLE GetCurrentThreadHandle()
{
#if defined(PYLON_WIN_BUILD)
return ::GetCurrentThread();
#elif defined(PYLON_HAS_POSIX_THREADS)
return pthread_self();
#else
# error Platform not supported.
#endif
}
inline int GetCurrentThreadIdentifier()
{
#if defined(PYLON_WIN_BUILD)
return static_cast<int>(::GetCurrentThreadId());
#elif defined(PYLON_LINUX_BUILD)
return static_cast<int>(pthread_self());
#elif defined(PYLON_HAS_POSIX_THREADS)
return reinterpret_cast<long int>(pthread_self());
#else
# error Platform not supported.
#endif
}
}
#ifdef _MSC_VER
# pragma pack(pop)
#endif /* _MSC_VER */
#endif //__THREADPRIORITY_H__
Updated on 5 July 2022 at 15:30:01