From: Kevron Rees Date: Mon, 11 Nov 2013 17:58:27 +0000 (-0800) Subject: stubbed in threading using boost::future X-Git-Tag: 0.10.804~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a825db03bd5e608311290d2d6803475da5a209df;p=profile%2Fivi%2Fautomotive-message-broker.git stubbed in threading using boost::future --- diff --git a/plugins/opencvlux/CMakeLists.txt b/plugins/opencvlux/CMakeLists.txt index 17ebedb..64a8d65 100644 --- a/plugins/opencvlux/CMakeLists.txt +++ b/plugins/opencvlux/CMakeLists.txt @@ -8,6 +8,9 @@ else(OpenCV_LIBS) message(FATAL_ERROR "opencv missing. please install opencv") endif(OpenCV_LIBS) +find_package(Boost COMPONENTS thread REQUIRED) +find_package(Threads REQUIRED) + #find opencv ocl headers: find_path(ocl ocl.hpp PATH_SUFFIXES opencv/ocl opencv2/ocl DOC "opencv ocl headers") @@ -27,14 +30,14 @@ else(cuda) message(STATUS "no opencv cuda headers found. no cuda support") endif(cuda) -include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS}) +include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${OpenCV_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}) set(opencvluxplugin_headers opencvluxplugin.h) set(opencvluxplugin_sources opencvluxplugin.cpp) add_library(opencvluxplugin MODULE ${opencvluxplugin_sources} ${opencvluxplugin_headers_moc}) set_target_properties(opencvluxplugin PROPERTIES PREFIX "") -target_link_libraries(opencvluxplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${OpenCV_LIBS}) +target_link_libraries(opencvluxplugin amb -L${CMAKE_CURRENT_BINARY_DIR}/lib ${link_libraries} ${OpenCV_LIBS} ${Boost_LIBRARIES}) install(TARGETS opencvluxplugin LIBRARY DESTINATION lib${LIB_SUFFIX}/automotive-message-broker) diff --git a/plugins/opencvlux/opencvluxplugin.cpp b/plugins/opencvlux/opencvluxplugin.cpp index d2181f0..545a017 100644 --- a/plugins/opencvlux/opencvluxplugin.cpp +++ b/plugins/opencvlux/opencvluxplugin.cpp @@ -21,6 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include #include +#include #ifdef OPENCL #include @@ -229,9 +230,16 @@ static int grabImage(void *data) *(shared->m_capture) >> m_image; } - uint lux = evalImage(m_image,shared); - - shared->parent->updateProperty(lux); + /*if(shared->threaded) + { + auto luxFuture = boost::async([m_image, &shared](){ return evalImage(m_image,shared); }); + luxFuture.then([&shared](boost::shared_future f) { shared->parent->updateProperty(f.get()); }); + } + else*/ + { + int lux = evalImage(m_image,shared); + shared->parent->updateProperty(lux); + } if(shared->mRequests.size()) {