Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7737 in orxonox.OLD for trunk/src/lib/util


Ignore:
Timestamp:
May 19, 2006, 11:38:34 PM (19 years ago)
Author:
bensch
Message:

Using MultiLine-Text in the Shell. This is much faster, and Nicer :)

Location:
trunk/src/lib/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/util/threading.cc

    r7329 r7737  
    2020using namespace std;
    2121
     22namespace OrxThread
     23{
    2224
    2325/**
     
    2527 * @todo this constructor is not jet implemented - do it
    2628*/
    27 Threading::Threading ()
     29Thread::Thread()
    2830{
    2931}
     
    3335 * standard deconstructor
    3436*/
    35 Threading::~Threading ()
     37Thread::~Thread()
    3638{
    3739  // delete what has to be deleted here
    3840}
     41
     42}
  • trunk/src/lib/util/threading.h

    r7331 r7737  
    1515#endif
    1616
     17namespace OrxThread
     18{
     19  //! A class for Wrapping Threads
     20  class Thread
     21  {
    1722
    18 //! A class for Wrapping Threads
    19 class Threading
    20 {
    21 
    22 public:
    23   Threading();
    24   virtual ~Threading();
     23  public:
     24    Thread();
     25    virtual ~Thread();
    2526
    2627
    27 private:
     28  private:
    2829
    29 };
     30  };
    3031
    31 //! A Class that locks a Mutex within its scope
    32 class MutexLock
    33 {
    34 public:
    35   //! Locks the Mutex mutex in this Scope.
    36   MutexLock(SDL_mutex* mutex) { SDL_mutexP(mutex); this->mutex = mutex; };
    37   ~MutexLock() { SDL_mutexV(mutex); };
    38 private:
    39   SDL_mutex* mutex;         //!< The Mutex to lock.
    40 };
     32  class Mutex
     33  {
     34  public:
     35    Mutex() {  this->mutex = SDL_CreateMutex(); };
     36    ~Mutex() { SDL_DestroyMutex(this->mutex); }
    4137
     38    void lock() { SDL_mutexP(mutex); };
     39    void unlock() { SDL_mutexV(mutex); };
     40
     41    SDL_mutex* getMutex() const { return this->mutex; };
     42  private:
     43    SDL_mutex* mutex;
     44  };
     45
     46  //! A Class that locks a Mutex within its scope
     47  class MutexLock
     48  {
     49  public:
     50    //! Locks the Mutex mutex in this Scope.
     51    MutexLock(Mutex* mutex) { SDL_mutexP(mutex->getMutex()); this->mutex = mutex; };
     52    ~MutexLock() { SDL_mutexV(mutex->getMutex()); };
     53  private:
     54    Mutex* mutex;         //!< The Mutex to lock.
     55  };
     56}
    4257
    4358#endif /* _THREADING_H */
Note: See TracChangeset for help on using the changeset viewer.