Changeset 3:e4ca2e057cec in xplcommon for src/xplcommon/posix/Thread.h


Ignore:
Timestamp:
12/27/12 13:01:22 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Reorganized the code a bit

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/xplcommon/posix/Thread.h

    r1 r3  
    2828// either expressed or implied, of the FreeBSD Project.
    2929
    30 #ifndef XPLCOMMON_POSIXTHREAD_H
    31 #define XPLCOMMON_POSIXTHREAD_H
    32 //------------------------------------------------------------------------------
    33 
    34 #include "config.h"
    35 
    36 #ifdef HAVE_PTHREAD_H
    37 
     30#ifndef XPLCOMMON_POSIX_THREAD_H
     31#define XPLCOMMON_POSIX_THREAD_H
    3832//------------------------------------------------------------------------------
    3933
     
    4236//------------------------------------------------------------------------------
    4337
    44 namespace xplcommon {
     38namespace xplcommon { namespace posix {
    4539
    4640//------------------------------------------------------------------------------
     
    4943 * A pthreads-based thread implementation.
    5044 */
    51 class POSIXThread
     45class Thread
    5246{
    5347private:
     
    6660     * Virtual destructor.
    6761     */
    68     virtual ~POSIXThread();
     62    virtual ~Thread();
    6963
    7064    /**
     
    8781
    8882//------------------------------------------------------------------------------
    89 
    90 /// Common type for OS-independent code
    91 typedef POSIXThread Thread;
    92 
    93 //------------------------------------------------------------------------------
    9483// Inline definitions
    9584//------------------------------------------------------------------------------
    9685
    97 inline POSIXThread::~POSIXThread()
     86inline Thread::~Thread()
    9887{
    9988}
     
    10190//------------------------------------------------------------------------------
    10291
    103 inline bool POSIXThread::start()
     92inline bool Thread::start()
    10493{
    10594    return pthread_create(&thread, 0, &threadFn, this)>=0;
     
    10897//------------------------------------------------------------------------------
    10998
    110 inline void POSIXThread::join()
     99inline void Thread::join()
    111100{
    112101    pthread_join(thread, 0);
     
    115104//------------------------------------------------------------------------------
    116105
    117 } /* namespace xplcommon */
     106} /* namespace xplcommon::posix */ } /* namespace xplcommon */
    118107
    119108//------------------------------------------------------------------------------
    120 #endif // HAVE_PTHREAD_H
    121 
    122 #endif // XPLCOMMON_POSIXTHREAD_H
     109#endif // XPLCOMMON_POSIX_THREAD_H
    123110
    124111// Local Variables:
Note: See TracChangeset for help on using the changeset viewer.