- Simplify some threading code by not saving the return status
(also fixes 2 gcc warnings) git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@673 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
7227fa0c4e
commit
f026c57cd2
2 changed files with 16 additions and 15 deletions
|
@ -29,7 +29,7 @@
|
|||
#define LOKI_pthread_create(handle,attr,func,arg) \
|
||||
(int)((*handle=(HANDLE) _beginthreadex (NULL,0,(ThreadFunction_)func,arg,0,NULL))==NULL)
|
||||
|
||||
#define LOKI_pthread_join(thread, result) \
|
||||
#define LOKI_pthread_join(thread) \
|
||||
((WaitForSingleObject((thread),INFINITE)!=WAIT_OBJECT_0) || !CloseHandle(thread))
|
||||
|
||||
#else
|
||||
|
@ -38,8 +38,8 @@
|
|||
pthread_t
|
||||
#define LOKI_pthread_create(handle,attr,func,arg) \
|
||||
pthread_create(handle,attr,func,arg)
|
||||
#define LOKI_pthread_join(thread, result) \
|
||||
pthread_join(thread, result)
|
||||
#define LOKI_pthread_join(thread) \
|
||||
pthread_join(thread, NULL)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -72,15 +72,11 @@ namespace Loki
|
|||
|
||||
static int WaitForThread(const Thread& thread)
|
||||
{
|
||||
int status = 0;
|
||||
(void) status;
|
||||
return LOKI_pthread_join(thread.pthread_, reinterpret_cast<void **>(&status));
|
||||
return LOKI_pthread_join(thread.pthread_);
|
||||
}
|
||||
|
||||
static void JoinThreads(const std::vector<Thread*>& threads)
|
||||
{
|
||||
int status = 0;
|
||||
(void) status;
|
||||
for(size_t i=0; i<threads.size(); i++)
|
||||
WaitForThread(*threads.at(i));
|
||||
}
|
||||
|
@ -108,6 +104,10 @@ namespace Loki
|
|||
#endif
|
||||
|
||||
// $Log$
|
||||
// Revision 1.5 2006/06/08 19:15:27 lfittl
|
||||
// - Simplify some threading code by not saving the return status
|
||||
// (also fixes 2 gcc warnings)
|
||||
//
|
||||
// Revision 1.4 2006/01/21 14:11:59 syntheticpp
|
||||
// remove gcc warnings
|
||||
//
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define LOKI_pthread_create(handle,attr,func,arg) \
|
||||
(int)((*handle=(HANDLE) _beginthreadex (NULL,0,(ThreadFunction_)func,arg,0,NULL))==NULL)
|
||||
|
||||
#define LOKI_pthread_join(thread, result) \
|
||||
#define LOKI_pthread_join(thread) \
|
||||
((::WaitForSingleObject((thread),INFINITE)!=WAIT_OBJECT_0) || !CloseHandle(thread))
|
||||
|
||||
#else
|
||||
|
@ -54,8 +54,8 @@
|
|||
pthread_t
|
||||
#define LOKI_pthread_create(handle,attr,func,arg) \
|
||||
pthread_create(handle,attr,func,arg)
|
||||
#define LOKI_pthread_join(thread, result) \
|
||||
pthread_join(thread, result)
|
||||
#define LOKI_pthread_join(thread) \
|
||||
pthread_join(thread, NULL)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -90,10 +90,7 @@ public:
|
|||
|
||||
int WaitForThread( void ) const
|
||||
{
|
||||
int status = 0;
|
||||
(void) status;
|
||||
return LOKI_pthread_join( pthread_,
|
||||
reinterpret_cast< void * * >( &status ) );
|
||||
return LOKI_pthread_join( pthread_ );
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -326,6 +323,10 @@ void DoLockedPtrTest( void )
|
|||
// ----------------------------------------------------------------------------
|
||||
|
||||
// $Log$
|
||||
// Revision 1.2 2006/06/08 19:15:27 lfittl
|
||||
// - Simplify some threading code by not saving the return status
|
||||
// (also fixes 2 gcc warnings)
|
||||
//
|
||||
// Revision 1.1 2006/04/28 00:34:21 rich_sposato
|
||||
// Added test for thread-safe StrongPtr policy.
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue