Changeset 8 in cheroxy for branches/b0_1_threading/src/CRXMutex.cpp


Ignore:
Timestamp:
10/23/12 13:39:29 (12 years ago)
Author:
cheese
Message:

#1 fix mutex code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/b0_1_threading/src/CRXMutex.cpp

    r7 r8  
    1212{
    1313    this->Unlock ();
     14    this->Destroy ();
    1415#ifdef _WIN32
    1516#else
     
    1718}
    1819
    19 int CRXMutex::Create ()
     20int CRXMutex::Create (void)
    2021{
    2122#ifdef _WIN32
    22     if ((mMutex = ::CreateMutexA(NULL, FALSE, NULL)) == NULL)
    23         return -1;
     23    if ((mMutex = ::CreateMutexA (NULL, FALSE, NULL)) == NULL)
     24        return GetLastError ();;
     25    else
     26        return 0;
    2427#else
    25     pthread_mutex_init (&mMutex, NULL);
     28    return pthread_mutex_init (&mMutex, NULL);
    2629#endif
     30}
    2731
    28     return 0;
     32int CRXMutex::Destroy (void)
     33{
     34#ifdef _WIN32
     35    if (::CloseHandle (mMutex))
     36        return GetLastError ();
     37    else
     38        return 0;
     39#else
     40    return pthread_mutex_destroy (&mMutex);
     41#endif
    2942}
    3043
Note: See TracChangeset for help on using the changeset viewer.