summaryrefslogtreecommitdiffstats
path: root/client/platform.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2009-11-08 16:34:12 +0200
committerYaniv Kamay <ykamay@redhat.com>2009-11-09 14:39:33 +0200
commit8d5b738ba169c44d223ab6d99ec12e763ce5bc8e (patch)
tree3c1d4dd1b3c32f9a03dd456ea921a66ed7f6c7fd /client/platform.h
parent082934699611d5985ecf3386259d270d75e41c12 (diff)
downloadspice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.gz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.tar.xz
spice-8d5b738ba169c44d223ab6d99ec12e763ce5bc8e.zip
spice client: creating a general process loop.
The process loop is responsible for: 1) waiting for events 2) timers 3) events queue for actions that should be performed in the context of the thread and are pushed from other threads. The benefits: 1) remove duplicity: till now, there was one implementaion of events loop for the channels and another one for the main thread. 2) timers can be executed on each thread and not only on the main thread. 3) events can be pushed to each thread and not only to the main thread. In this commit, only the main thread was modified to use the new process loop.
Diffstat (limited to 'client/platform.h')
-rw-r--r--client/platform.h31
1 files changed, 19 insertions, 12 deletions
diff --git a/client/platform.h b/client/platform.h
index 0982bf63..a4310d98 100644
--- a/client/platform.h
+++ b/client/platform.h
@@ -19,12 +19,10 @@
#define _H_PLATFORM
#include "cursor.h"
+#include "process_loop.h"
+#include "event_sources.h"
#include "events_loop.h"
-#define INVALID_TIMER (~TimerID(0))
-typedef unsigned long TimerID;
-typedef void (*timer_proc_t)(void* opaque, TimerID timer);
-
class WaveRecordAbstract;
class WavePlaybackAbstract;
class Icon;
@@ -32,19 +30,19 @@ class Icon;
class Monitor;
typedef std::list<Monitor*> MonitorsList;
+/* TODO: tmp till each channel will handle its own thread
+ timers or directly through the main thread */
+#define INVALID_TIMER (~TimerID(0))
+typedef unsigned long TimerID;
+typedef void (*timer_proc_t)(void* opaque, TimerID timer);
+
+
class Platform {
public:
static void init();
- static void wait_events();
- static bool process_events();
- static void wakeup();
+ static void set_process_loop(ProcessLoop& main_process_loop);
static void msleep(unsigned int millisec);
static void yield();
- static void send_quit_request();
- static TimerID create_interval_timer(timer_proc_t proc, void* opaque);
- static bool activate_interval_timer(TimerID timer, unsigned int millisec);
- static bool deactivate_interval_timer(TimerID timer);
- static void destroy_interval_timer(TimerID timer);
static uint64_t get_monolithic_time();
static void get_temp_dir(std::string& path);
@@ -52,6 +50,8 @@ public:
static void destroy_monitors();
static bool is_monitors_pos_valid();
+ static void send_quit_request();
+
enum ThreadPriority {
PRIORITY_INVALID,
PRIORITY_TIME_CRITICAL,
@@ -98,6 +98,12 @@ public:
class DisplayModeListner;
static void set_display_mode_listner(DisplayModeListner* listener);
+ /* TODO: tmp till each channel will handle its own thread
+ timers or directly through the main thread */
+ static TimerID create_interval_timer(timer_proc_t proc, void* opaque);
+ static bool activate_interval_timer(TimerID timer, unsigned int millisec);
+ static bool deactivate_interval_timer(TimerID timer);
+ static void destroy_interval_timer(TimerID timer);
};
class Platform::EventListener {
@@ -108,6 +114,7 @@ public:
virtual void on_monitors_change() = 0;
};
+// TODO: tmp till all channels work with ProcessLoop
class Platform::RecordClinet {
public:
virtual ~RecordClinet() {}