Changeset 20:38521bf10e24 in xplcommon


Ignore:
Timestamp:
12/30/12 16:45:26 (12 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Implemented the Waiter and the WaitableEvent classes for Windows

Files:
8 added
8 edited

Legend:

Unmodified
Added
Removed
  • src/xplcommon/Failable.h

    r14 r20  
    115115
    116116inline Failable::Failable() :
    117     errorCode(NO_ERROR)
     117    errorCode(XPL_NO_ERROR)
    118118{
    119119}
     
    123123inline bool Failable::failed() const
    124124{
    125     return errorCode!=NO_ERROR;
     125    return errorCode!=XPL_NO_ERROR;
    126126}
    127127
     
    137137inline void Failable::repair()
    138138{
    139     errorCode = NO_ERROR;
     139    errorCode = XPL_NO_ERROR;
    140140}
    141141
  • src/xplcommon/Thread.h

    r7 r20  
    4646class Thread
    4747{
     48public:
     49    /**
     50     * Sleep for the given number of milliseconds.
     51     */
     52    static void sleep(unsigned millis);
     53
    4854public:
    4955    /**
  • src/xplcommon/WaitableEvent.h

    r17 r20  
    9696//------------------------------------------------------------------------------
    9797
    98 // #include "win32/WaitableEvent.h"
     98#include "win32/WaitableEvent.h"
    9999
    100 // namespace xplcommon { typedef win32::WaitableEvent WaitableEvent; }
     100namespace xplcommon { typedef win32::WaitableEvent WaitableEvent; }
    101101
    102102//------------------------------------------------------------------------------
  • src/xplcommon/Waiter.h

    r17 r20  
    8383//------------------------------------------------------------------------------
    8484
    85 // #include "win32/Waiter.h"
     85#include "win32/Waiter.h"
    8686
    87 // namespace xplcommon { typedef win32::Waiter Waiter; }
     87namespace xplcommon { typedef win32::Waiter Waiter; }
    8888
    8989//------------------------------------------------------------------------------
  • src/xplcommon/types.h

    r6 r20  
    4949
    5050typedef DWORD errorCode_t;
    51 static const DWORD NO_ERROR = 0;
     51static const DWORD XPL_NO_ERROR = 0;
    5252
    5353//------------------------------------------------------------------------------
     
    5858
    5959typedef int errorCode_t;
    60 static const int NO_ERROR = 0;
     60static const int XPL_NO_ERROR = 0;
    6161
    6262//------------------------------------------------------------------------------
  • src/xplcommon/win32/Makefile.am

    r3 r20  
    22
    33libxplcommon_win32_la_SOURCES = \
    4         Thread.cc
     4        Thread.cc               \
     5        Event.cc                \
     6        Overlapped.cc           \
     7        Waiter.cc               \
     8        WaitableEvent.cc
    59
    610include_xplcommon_win32dir=$(includedir)/xplcommon/win32
    711include_xplcommon_win32_HEADERS=\
    8         Thread.h
     12        Thread.h                \
     13        Event.h                 \
     14        Overlapped.h            \
     15        Waiter.h                \
     16        WaitableEvent.h
  • src/xplcommon/win32/Thread.h

    r3 r20  
    4545class Thread
    4646{
     47public:
     48    /**
     49     * Sleep for the given number of milliseconds.
     50     */
     51    static void sleep(unsigned millis);
     52
    4753private:
    4854    /**
     
    8490//------------------------------------------------------------------------------
    8591
     92inline void Thread::sleep(unsigned millis)
     93{
     94    Sleep(millis);
     95}
     96
     97//------------------------------------------------------------------------------
     98
    8699inline Thread::~Thread()
    87100{
  • test/Makefile.am

    r18 r20  
    44
    55testevent_SOURCES=testevent.cc
    6 testevent_LDADD=../src/xplcommon/libxplcommon.la -lpthread
     6testevent_LDADD=../src/xplcommon/libxplcommon.la
     7if TARGET_API_POSIX
     8testevent_LDADD+=-lpthread
     9endif
     10if TARGET_API_WIN32
     11testevent_LDFLAGS=-static-libgcc -static-libstdc++
     12endif
    713
    814testlocsock_SOURCES=testlocsock.cc
    9 testlocsock_LDADD=../src/xplcommon/libxplcommon.la -lpthread
     15testlocsock_LDADD=../src/xplcommon/libxplcommon.la
     16if TARGET_API_POSIX
     17testlocsock_LDADD+=-lpthread
     18endif
     19if TARGET_API_WIN32
     20testlocsock_LDFLAGS=-static-libgcc -static-libstdc++
     21endif
Note: See TracChangeset for help on using the changeset viewer.