[swift-users] NetBSD patches for swift-2.0

Thomas Klausner tk at giga.or.at
Fri Jan 17 12:29:12 CET 2014


Hi Remko!

> Thanks a lot for the patches. It looks like these patches will have
> issues on other platforms, though. We will see if we can fix this in a
> way that works for other platforms too.

Ok. Attached is my current version of the lock patch. The one for
BuildTools/SCons/Tools/qt4.py should be uncontroversial though, right?

> The lock_guard problem was due to a missing include, and has been
> fixed on the master and swift-2.x branch already.

Can you point me to the commit? I tried finding it, but the branch
names/tags are not clear enough for me.

> The Qt problem is a strange one. Which Qt are you using, Qt4 or Qt5?

Forget about this one -- I've just retried with qt4 and it's not
necessary. Perhaps it was a leftover from qt3 times? Who knows :)
 Thomas
-------------- next part --------------
$NetBSD$

Fix build with latest boost and clang.

--- Swiften/EventLoop/EventLoop.cpp.orig	2012-12-22 12:23:59.000000000 +0000
+++ Swiften/EventLoop/EventLoop.cpp
@@ -10,6 +10,7 @@
 #include <boost/bind.hpp>
 #include <iostream>
 #include <cassert>
+#include <cstddef>
 
 #include <Swiften/Base/Log.h>
 
@@ -47,7 +48,11 @@ void EventLoop::handleEvent(const Event&
 
 	bool doCallback = false;
 	{
+#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
+		std::lock_guard<boost::mutex> lock(eventsMutex_);
+#else
 		boost::lock_guard<boost::mutex> lock(eventsMutex_);
+#endif
 		std::list<Event>::iterator i = std::find(events_.begin(), events_.end(), event);
 		if (i != events_.end()) {
 			doCallback = true;
@@ -72,7 +77,11 @@ void EventLoop::handleEvent(const Event&
 void EventLoop::postEvent(boost::function<void ()> callback, boost::shared_ptr<EventOwner> owner) {
 	Event event(owner, callback);
 	{
+#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
+		std::lock_guard<boost::mutex> lock(eventsMutex_);
+#else
 		boost::lock_guard<boost::mutex> lock(eventsMutex_);
+#endif
 		event.id = nextEventID_;
 		nextEventID_++;
 		events_.push_back(event);
@@ -82,7 +91,11 @@ void EventLoop::postEvent(boost::functio
 }
 
 void EventLoop::removeEventsFromOwner(boost::shared_ptr<EventOwner> owner) {
+#if __cplusplus >= 201103L || defined(_LIBCPP_VERSION)
+		std::lock_guard<boost::mutex> lock(eventsMutex_);
+#else
 		boost::lock_guard<boost::mutex> lock(eventsMutex_);
+#endif
 		events_.remove_if(HasOwner(owner));
 }
 


More information about the swift-users mailing list