~vanvugt/mir/pageflip-timings

« back to all changes in this revision

Viewing changes to src/include/server/mir/glib_main_loop.h

  • Committer: Tarmac
  • Author(s): Alexandros Frantzis
  • Date: 2014-11-12 20:20:56 UTC
  • mfrom: (2026.1.12 glib-main-loop-timer)
  • Revision ID: tarmac-20141112202056-n5qvrhn39jyn0by5
server: Add timer support to GLibMainLoop.

Approved by Kevin DuBois, Alan Griffiths, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
class GLibMainLoop
50
50
{
51
51
public:
52
 
    GLibMainLoop();
 
52
    GLibMainLoop(std::shared_ptr<time::Clock> const& clock);
53
53
 
54
54
    void run();
55
55
    void stop();
69
69
    void pause_processing_for(void const* owner);
70
70
    void resume_processing_for(void const* owner);
71
71
 
 
72
    std::unique_ptr<mir::time::Alarm> notify_in(
 
73
        std::chrono::milliseconds delay,
 
74
        std::function<void()> callback);
 
75
 
 
76
    std::unique_ptr<mir::time::Alarm> notify_at(
 
77
        mir::time::Timestamp t,
 
78
        std::function<void()> callback);
 
79
 
 
80
    std::unique_ptr<mir::time::Alarm> create_alarm(
 
81
        std::function<void()> callback);
 
82
 
 
83
    void reprocess_all_sources();
 
84
 
72
85
private:
73
86
    bool should_process_actions_for(void const* owner);
74
87
 
 
88
    std::shared_ptr<time::Clock> const clock;
75
89
    detail::GMainContextHandle const main_context;
76
90
    std::atomic<bool> running;
77
91
    detail::FdSources fd_sources;
78
92
    std::mutex do_not_process_mutex;
79
93
    std::vector<void const*> do_not_process;
 
94
    std::function<void()> before_iteration_hook;
80
95
};
81
96
 
82
97
}