mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0026784: Coding rules - eliminate GCC warning -Wunused-parameter
OSD_Thread - use pthread_timedjoin_np() instead of pthread_join() when available (glibc extension). Suppress unused parameter warning in OSD_Signal, NCollection_WinHeapAllocator, OpenGl_Text, OpenGl_View, V3d_View and ViewerTest.
This commit is contained in:
@@ -258,7 +258,7 @@ Standard_Boolean OSD_Thread::Wait (Standard_Address &result) const
|
||||
// OSD_Thread::Wait
|
||||
//=============================================
|
||||
|
||||
Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address &result) const
|
||||
Standard_Boolean OSD_Thread::Wait (const Standard_Integer theTimeMs, Standard_Address &result) const
|
||||
{
|
||||
// check that thread handle is not null
|
||||
result = 0;
|
||||
@@ -268,7 +268,7 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
|
||||
#ifdef _WIN32
|
||||
|
||||
// On Windows, wait for the thread handle to be signaled
|
||||
DWORD ret = WaitForSingleObject ( myThread, time );
|
||||
DWORD ret = WaitForSingleObject (myThread, theTimeMs);
|
||||
if (ret == WAIT_OBJECT_0)
|
||||
{
|
||||
DWORD anExitCode;
|
||||
@@ -284,11 +284,32 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
|
||||
return Standard_False;
|
||||
|
||||
#else
|
||||
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||
#if __GLIBC_PREREQ(2,4)
|
||||
#define HAS_TIMED_NP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// On Unix/Linux, join the thread
|
||||
return ! pthread_join ( myThread, &result );
|
||||
#ifdef HAS_TIMED_NP
|
||||
struct timespec aTimeout;
|
||||
if (clock_gettime (CLOCK_REALTIME, &aTimeout) == -1)
|
||||
{
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
#endif
|
||||
time_t aSeconds = (theTimeMs / 1000);
|
||||
long aMicroseconds = (theTimeMs - aSeconds * 1000) * 1000;
|
||||
aTimeout.tv_sec += aSeconds;
|
||||
aTimeout.tv_nsec += aMicroseconds * 1000;
|
||||
|
||||
return pthread_timedjoin_np (myThread, &result, &aTimeout) == 0;
|
||||
#else
|
||||
// join the thread without timeout
|
||||
(void )theTimeMs;
|
||||
return pthread_join (myThread, &result) == 0;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
//=============================================
|
||||
|
@@ -115,7 +115,11 @@ static sigfpe_handler_type *GetOldFPE()
|
||||
//==== SIGSEGV is handled by "SegvHandler()"
|
||||
//============================================================================
|
||||
#ifdef SA_SIGINFO
|
||||
#if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
|
||||
static void Handler (const int theSignal, siginfo_t *theSigInfo, const Standard_Address theContext)
|
||||
#else
|
||||
static void Handler (const int theSignal, siginfo_t */*theSigInfo*/, const Standard_Address /*theContext*/)
|
||||
#endif
|
||||
#else
|
||||
static void Handler (const int theSignal)
|
||||
#endif
|
||||
@@ -338,6 +342,8 @@ static void SegvHandler(const int theSignal,
|
||||
Handler(theSignal, ip, theContext);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
(void )theContext;
|
||||
#endif
|
||||
#ifdef linux
|
||||
if (fFltExceptions)
|
||||
|
Reference in New Issue
Block a user