pEpCOMServerAdapter.h
author Volker Birk <vb@pep-project.org>
Wed, 07 Dec 2016 20:53:29 +0100
changeset 227 5bc3d8cb9415
parent 215 033aa489f9d6
permissions -rw-r--r--
changing interface for sync handshake
     1 #include "stdafx.h"
     2 
     3 #include "pEpCOMServerAdapter_i.h"
     4 
     5 using namespace ATL;
     6 using namespace std;
     7 
     8 class CpEpCOMServerAdapterModule : public ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule > {
     9 public:
    10     CpEpCOMServerAdapterModule() : ATL::CAtlExeModuleT< CpEpCOMServerAdapterModule >(), gatekeeper_thread(NULL), _hModule(NULL)
    11     {
    12     }
    13 
    14     DECLARE_LIBID(LIBID_pEpCOMServerAdapterLib)
    15     DECLARE_REGISTRY_APPID_RESOURCEID(IDR_PEPCOMSERVERADAPTER, "{B3480081-82C0-4EE4-9AA1-3F513C9D78DD}")
    16 
    17     HMODULE hModule()
    18     {
    19         return _hModule;
    20     }
    21 
    22     void hModule(HMODULE m)
    23     {
    24         _hModule = m;
    25     }
    26 
    27     void start_gatekeeper()
    28     {
    29 #ifdef NDEBUG
    30         this->Lock(); // never exit
    31 #endif
    32 
    33         try {
    34             gatekeeper_thread = new thread(gatekeeper, this);
    35             gatekeeper_thread->detach();
    36         }
    37         catch (system_error&) {
    38 
    39         }
    40     }
    41 
    42 protected:
    43     static void gatekeeper(CpEpCOMServerAdapterModule * self);
    44 
    45 private:
    46     thread *gatekeeper_thread;
    47     HMODULE _hModule;
    48 };