aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/helpers/sync/SyncReleaser.hpp
blob: e21d2e34bd2dbd315407ff21fac4d3f9322f5388 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#include <cstdint>
#include <optional>
#include <vector>
#include <functional>
#include "../memory/Memory.hpp"

/*
    A helper (inspired by KDE's KWin) that will release the timeline point in the dtor
*/

class CSyncTimeline;
class CEGLSync;

class CSyncReleaser {
  public:
    CSyncReleaser(WP<CSyncTimeline> timeline_, uint64_t point_);
    ~CSyncReleaser();

    // drops the releaser, will never signal anymore
    void drop();

    // wait for this gpu job to finish before releasing
    void addReleaseSync(SP<CEGLSync> sync);

  private:
    WP<CSyncTimeline> timeline;
    uint64_t          point = 0;
    SP<CEGLSync>      sync;
};