basic implementation of callbacks sync
authorVolker Birk <vb@pep.foundation>
Thu, 16 Aug 2018 17:13:19 +0200
branchsync
changeset 2853f5f2abf9adcf
parent 2852 135a3e49e48d
child 2854 f4728cd6a9b8
basic implementation of callbacks
test/include/locked_queue.hh
test/src/engine_tests/SyncTests.cc
     1.1 --- a/test/include/locked_queue.hh	Thu Aug 16 15:28:36 2018 +0200
     1.2 +++ b/test/include/locked_queue.hh	Thu Aug 16 17:13:19 2018 +0200
     1.3 @@ -23,15 +23,19 @@
     1.4              lock_guard<mutex> lg(_mtx);
     1.5              return _q.front();
     1.6          }
     1.7 -        void pop_back()
     1.8 +        T pop_back()
     1.9          {
    1.10              lock_guard<mutex> lg(_mtx);
    1.11 +            T r = _q.back();
    1.12              _q.pop_back();
    1.13 +            return r;
    1.14          }
    1.15 -        void pop_front()
    1.16 +        T pop_front()
    1.17          {
    1.18              lock_guard<mutex> lg(_mtx);
    1.19 +            T r = _q.front();
    1.20              _q.pop_front();
    1.21 +            return r;
    1.22          }
    1.23          void push_back(const T& data)
    1.24          {
     2.1 --- a/test/src/engine_tests/SyncTests.cc	Thu Aug 16 15:28:36 2018 +0200
     2.2 +++ b/test/src/engine_tests/SyncTests.cc	Thu Aug 16 17:13:19 2018 +0200
     2.3 @@ -31,11 +31,14 @@
     2.4  
     2.5      static int inject_sync_event(SYNC_EVENT ev, void *management)
     2.6      {
     2.7 +        auto adapter = static_cast< Sync_Adapter *>(management);
     2.8 +        adapter->q.push_front(ev);
     2.9          return 0;
    2.10      }
    2.11      static Sync_event_t *retrieve_next_sync_event(void *management)
    2.12      {
    2.13 -        return NULL;
    2.14 +        auto adapter = static_cast< Sync_Adapter *>(management);
    2.15 +        return adapter->q.pop_front();
    2.16      }
    2.17  };
    2.18