summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/EventLoop')
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEvent.h5
-rw-r--r--Swiften/EventLoop/Cocoa/CocoaEvent.mm5
-rw-r--r--Swiften/EventLoop/EventLoop.cpp8
-rw-r--r--Swiften/EventLoop/EventLoop.h5
-rw-r--r--Swiften/EventLoop/SConscript2
-rw-r--r--Swiften/EventLoop/SimpleEventLoop.cpp2
6 files changed, 12 insertions, 15 deletions
diff --git a/Swiften/EventLoop/Cocoa/CocoaEvent.h b/Swiften/EventLoop/Cocoa/CocoaEvent.h
index bede7ff..d396678 100644
--- a/Swiften/EventLoop/Cocoa/CocoaEvent.h
+++ b/Swiften/EventLoop/Cocoa/CocoaEvent.h
@@ -13,10 +13,7 @@ namespace Swift {
class CocoaEventLoop;
}
-@interface CocoaEvent : NSObject {
- Swift::Event* event;
- Swift::CocoaEventLoop* eventLoop;
-}
+@interface CocoaEvent : NSObject
// Takes ownership of event
- (id) initWithEvent: (Swift::Event*) e eventLoop: (Swift::CocoaEventLoop*) el;
diff --git a/Swiften/EventLoop/Cocoa/CocoaEvent.mm b/Swiften/EventLoop/Cocoa/CocoaEvent.mm
index 049e3b6..05fd2a0 100644
--- a/Swiften/EventLoop/Cocoa/CocoaEvent.mm
+++ b/Swiften/EventLoop/Cocoa/CocoaEvent.mm
@@ -2,7 +2,10 @@
#include <Swiften/EventLoop/Event.h>
#include <Swiften/EventLoop/Cocoa/CocoaEventLoop.h>
-@implementation CocoaEvent
+@implementation CocoaEvent {
+ Swift::Event* event;
+ Swift::CocoaEventLoop* eventLoop;
+}
- (id) initWithEvent: (Swift::Event*) e eventLoop: (Swift::CocoaEventLoop*) el {
self = [super init];
diff --git a/Swiften/EventLoop/EventLoop.cpp b/Swiften/EventLoop/EventLoop.cpp
index cd4e461..014b81f 100644
--- a/Swiften/EventLoop/EventLoop.cpp
+++ b/Swiften/EventLoop/EventLoop.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2013 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
@@ -13,7 +13,11 @@
#include <boost/thread/locks.hpp>
#include <Swiften/Base/Log.h>
+#include <boost/thread/locks.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/lambda/bind.hpp>
+namespace lambda = boost::lambda;
namespace Swift {
@@ -84,7 +88,7 @@ void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<E
void EventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) {
boost::lock_guard<boost::mutex> lock(eventsMutex_);
- events_.remove_if(HasOwner(owner));
+ events_.remove_if(lambda::bind(&Event::owner, lambda::_1) == owner);
}
}
diff --git a/Swiften/EventLoop/EventLoop.h b/Swiften/EventLoop/EventLoop.h
index 4a602ae..587ba22 100644
--- a/Swiften/EventLoop/EventLoop.h
+++ b/Swiften/EventLoop/EventLoop.h
@@ -35,11 +35,6 @@ namespace Swift {
void handleEvent(const Event& event);
private:
- struct HasOwner {
- HasOwner(boost::shared_ptr<EventOwner> owner) : owner(owner) {}
- bool operator()(const Event& event) const { return event.owner == owner; }
- boost::shared_ptr<EventOwner> owner;
- };
boost::mutex eventsMutex_;
unsigned int nextEventID_;
std::list<Event> events_;
diff --git a/Swiften/EventLoop/SConscript b/Swiften/EventLoop/SConscript
index b405f6b..8bef8fb 100644
--- a/Swiften/EventLoop/SConscript
+++ b/Swiften/EventLoop/SConscript
@@ -12,7 +12,7 @@ sources = [
objects = swiften_env.SwiftenObject(sources)
swiften_env.Append(SWIFTEN_OBJECTS = [objects])
-if swiften_env["PLATFORM"] == "darwin" :
+if swiften_env["PLATFORM"] == "darwin" and swiften_env["target"] == "native":
myenv = swiften_env.Clone()
myenv.Append(CXXFLAGS = myenv["OBJCCFLAGS"])
objects = myenv.SwiftenObject([
diff --git a/Swiften/EventLoop/SimpleEventLoop.cpp b/Swiften/EventLoop/SimpleEventLoop.cpp
index 63b8ba5..42a5481 100644
--- a/Swiften/EventLoop/SimpleEventLoop.cpp
+++ b/Swiften/EventLoop/SimpleEventLoop.cpp
@@ -14,8 +14,6 @@
namespace Swift {
-void nop() {}
-
SimpleEventLoop::SimpleEventLoop() : isRunning_(true) {
}