summaryrefslogtreecommitdiffstats
path: root/client/windows/event_sources_p.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/windows/event_sources_p.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/windows/event_sources_p.h')
-rw-r--r--client/windows/event_sources_p.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/client/windows/event_sources_p.h b/client/windows/event_sources_p.h
new file mode 100644
index 00000000..3477605e
--- /dev/null
+++ b/client/windows/event_sources_p.h
@@ -0,0 +1,52 @@
+/*
+ Copyright (C) 2009 Red Hat, Inc.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of
+ the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef _H_EVENT_SOURCES_P
+#define _H_EVENT_SOURCES_P
+
+#include "common.h"
+
+#include <vector>
+
+class EventSource;
+class Handle_p;
+
+class EventSources_p {
+protected:
+ /* return true if quit should be performed */
+ bool process_system_events();
+ void add_event(HANDLE event, EventSource* source);
+ void remove_event(EventSource* source);
+public:
+ std::vector<EventSource*> _events;
+ std::vector<HANDLE> _handles;
+};
+
+class Handle_p {
+public:
+ Handle_p();
+ virtual ~Handle_p();
+ HANDLE get_handle() { return _event;}
+protected:
+ HANDLE _event;
+};
+
+class Trigger_p: public Handle_p {
+};
+
+#endif
+