Scroom  0.14
helpers.hh
Go to the documentation of this file.
1 /*
2  * Scroom - Generic viewer for 2D data
3  * Copyright (C) 2009-2022 Kees-Jan Dijkzeul
4  *
5  * SPDX-License-Identifier: LGPL-2.1
6  */
7 
8 #pragma once
9 
10 #include <boost/function.hpp>
11 #include <boost/shared_ptr.hpp>
12 
13 #include <scroom/semaphore.hh>
14 #include <scroom/threadpool.hh>
15 
16 using namespace Scroom;
17 
18 boost::function<void()> pass(Semaphore* s);
19 boost::function<void()> clear(Semaphore* s);
20 boost::function<void()> destroy(boost::shared_ptr<void> p);
anonymous_namespace{threadpoolimpl.cc}::waiter
ThreadWaiter waiter
Definition: threadpoolimpl.cc:77
anonymous_namespace{threadpoolimpl.cc}::ThreadWaiter
Definition: threadpoolimpl.cc:63
ThreadPool::Job::Job
Job()=default
short_timeout
static const millisec short_timeout(250)
ThreadPool::ThreadPool
ThreadPool(bool completeAllJobsBeforeDestruction=false)
ThreadPool.
Definition: threadpoolimpl.cc:207
ThreadPool::Ptr
boost::shared_ptr< ThreadPool > Ptr
Definition: threadpool.hh:169
Scroom::Detail::ThreadPool::QueueImpl
Definition: queue.hh:22
assertions.hh
ThreadPool::Queue::Ptr
boost::shared_ptr< Queue > Ptr
Definition: threadpool.hh:82
A::s1
Semaphore * s1
Definition: async-deleter-tests.cc:37
threadpool.hh
helpers.hh
clear
boost::function< void()> clear(Semaphore *s)
Definition: helpers.cc:29
anonymous_namespace{threadpoolimpl.cc}::ThreadList::threads
std::list< ThreadPool::ThreadPtr > threads
Definition: threadpoolimpl.cc:45
CpuBound
ThreadPool::Ptr CpuBound()
Definition: threadpoolimpl.cc:452
ThreadPool::Queue::get
boost::shared_ptr< Scroom::Detail::ThreadPool::QueueImpl > get()
Definition: threadpoolimpl.cc:388
ThreadPool::WeakQueue::Ptr
boost::shared_ptr< WeakQueue > Ptr
Definition: threadpool.hh:137
Scroom
Definition: assertions.hh:14
ThreadPool
Definition: threadpool.hh:46
Scroom::Detail::ThreadPool::FunctionAdditor
Definition: function-additor.hh:16
ThreadPool::Queue::createAsync
static Ptr createAsync()
Definition: threadpoolimpl.cc:379
Scroom::MemoryBlocks::RawPageData::Ptr
boost::shared_ptr< uint8_t > Ptr
Definition: blockallocator.hh:23
Scroom::Detail::ThreadPool
Definition: async-deleter.hh:21
ThreadPool::PrivateData::create
static Ptr create(bool completeAllJobsBeforeDestruction)
Definition: threadpoolimpl.cc:198
QueueJumper::setWork
bool setWork(boost::function< void()> const &fn)
Definition: threadpoolimpl.cc:421
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(sample.expectedColors, originalColormap->colors.size())
Scroom::Detail::ThreadPool::QueueLock::queueExists
bool queueExists() const
Definition: queue.cc:61
anonymous_namespace{threadpoolimpl.cc}::ThreadWaiter::threadList
ThreadList::Ptr threadList
Definition: threadpoolimpl.cc:66
ThreadPool::PrivateData::PrivateData
PrivateData(bool completeAllJobsBeforeDestruction)
ThreadPool::PrivateData.
Definition: threadpoolimpl.cc:192
ThreadPool::Job
Definition: threadpool.hh:159
anonymous_namespace{helpers.cc}::clearImpl
void clearImpl(Semaphore *s)
Definition: helpers.cc:20
Sequentially
ThreadPool::Ptr Sequentially()
Definition: threadpoolimpl.cc:459
Scroom::Utils::Detail::abort
void abort() __attribute__((noreturn))
Definition: assertions.cc:126
ThreadPool::WeakQueue::WeakQueue
WeakQueue()
Definition: threadpoolimpl.cc:398
destroy
boost::function< void()> destroy(boost::shared_ptr< void > p)
Definition: helpers.cc:31
Scroom::Semaphore::try_P
bool try_P()
Definition: semaphore.hh:48
AsyncDeleter
Definition: async-deleter.hh:41
QueueJumper::create
static Ptr create()
QueueJumper.
Definition: threadpoolimpl.cc:419
Scroom::Semaphore::P
void P()
Definition: semaphore.hh:38
ThreadPool::Queue
Definition: threadpool.hh:79
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(clear_clears)
Definition: function-additor-tests.cc:33
QueueJumper
Definition: threadpool.hh:534
anonymous_namespace{threadpoolimpl.cc}::ThreadList::Ptr
boost::shared_ptr< ThreadList > Ptr
Definition: threadpoolimpl.cc:41
ThreadPool::defaultPriority
static const int defaultPriority
Definition: threadpool.hh:270
anonymous_namespace{helpers.cc}::destroyImpl
void destroyImpl(boost::shared_ptr< void > &p)
Definition: helpers.cc:22
ThreadPool::Queue::create
static Ptr create()
ThreadPool::Queue.
Definition: threadpoolimpl.cc:377
QueueJumper::Ptr
boost::shared_ptr< QueueJumper > Ptr
Definition: threadpool.hh:537
anonymous_namespace{threadpoolimpl.cc}::ThreadList::mut
boost::mutex mut
Definition: threadpoolimpl.cc:44
ThreadPool::WeakQueue
Definition: threadpool.hh:134
ThreadPool::WeakQueue::get
boost::shared_ptr< Scroom::Detail::ThreadPool::QueueImpl > get()
Definition: threadpoolimpl.cc:403
wait
bool wait()
Definition: test-helpers.cc:134
ThreadPool::defaultQueue
static Queue::Ptr defaultQueue()
Definition: threadpoolimpl.cc:365
CpuBound
ThreadPool::Ptr CpuBound()
Definition: threadpoolimpl.cc:452
ThreadPool::Queue::getWeak
boost::shared_ptr< WeakQueue > getWeak()
Definition: threadpoolimpl.cc:390
ThreadPool::WeakQueue::create
static Ptr create()
ThreadPool::WeakQueue.
Definition: threadpoolimpl.cc:396
Scroom::Semaphore
Definition: semaphore.hh:15
async-deleter.hh
long_timeout
static const millisec long_timeout(2000)
Scroom::Detail::ThreadPool::QueueLock
Definition: queue.hh:63
destroy
boost::function< void()> destroy(boost::shared_ptr< void > p)
Definition: helpers.cc:31
ThreadPool::create
static ThreadPool::Ptr create(bool completeAllJobsBeforeDestruction=false)
Definition: threadpoolimpl.cc:228
ThreadPool::PrivateData::Ptr
boost::shared_ptr< PrivateData > Ptr
Definition: threadpool.hh:196
Scroom::Detail::ThreadPool::QueueImpl::Ptr
boost::shared_ptr< QueueImpl > Ptr
Definition: queue.hh:25
A::s2
Semaphore * s2
Definition: async-deleter-tests.cc:38
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(deleter_deletes_asynchronously)
Definition: async-deleter-tests.cc:62
anonymous_namespace{progressbarmanager.cc}::instance
ProgressBarPulser::Ptr instance()
Definition: progressbarmanager.cc:43
BOOST_REQUIRE
BOOST_REQUIRE(originalColormap)
pass
boost::function< void()> pass(Semaphore *s)
Definition: helpers.cc:27
ThreadPool::Job::fn
boost::function< void()> fn
Definition: threadpool.hh:162
short_timeout
static const millisec short_timeout(250)
ThreadPool::Queue::~Queue
~Queue()
Definition: threadpoolimpl.cc:386
clear
boost::function< void()> clear(Semaphore *s)
Definition: helpers.cc:29
long_timeout
static const millisec long_timeout(2000)
anonymous_namespace{threadpoolimpl.cc}::ThreadList
Definition: threadpoolimpl.cc:38
ThreadPool::Queue::Queue
Queue()
Definition: threadpoolimpl.cc:381
ThreadPool::PrivateData
Definition: threadpool.hh:193
A
Definition: boost-bind.cc:21
function-additor.hh
A::A
A(Semaphore *s1_, Semaphore *s2_)
Definition: async-deleter-tests.cc:41
anonymous_namespace{threadpoolimpl.cc}::ThreadWaiter::~ThreadWaiter
~ThreadWaiter()
Definition: threadpoolimpl.cc:185
ThreadPool::do_one
static void do_one(const PrivateData::Ptr &priv)
Definition: threadpoolimpl.cc:308
defect_message
#define defect_message(m)
Definition: assertions.hh:43
ThreadPool::add
ThreadPtr add()
Definition: threadpoolimpl.cc:238
ThreadPool::ThreadPtr
boost::shared_ptr< boost::thread > ThreadPtr
Definition: threadpool.hh:170
Scroom::Semaphore::V
void V()
Definition: semaphore.hh:77
queue.hh
PRIO_NORMAL
@ PRIO_NORMAL
Definition: threadpool.hh:29
ThreadPool::work
static void work(const PrivateData::Ptr &priv)
Definition: threadpoolimpl.cc:273
ThreadPool::schedule
void schedule(boost::function< void()> const &fn, int priority=defaultPriority, const Queue::Ptr &queue=defaultQueue())
Definition: threadpoolimpl.cc:342
ThreadPool::priv
PrivateData::Ptr priv
Definition: threadpool.hh:247
anonymous_namespace{threadpoolimpl.cc}::ThreadList::pointers
std::list< std::pair< boost::weak_ptr< void >, std::string > > pointers
Definition: threadpoolimpl.cc:46
anonymous_namespace{threadpoolimpl.cc}::NotifyThreadList
boost::shared_ptr< T > NotifyThreadList(boost::shared_ptr< T > t, const std::string &s)
Definition: threadpoolimpl.cc:80
ThreadPool::Job::queue
boost::shared_ptr< Scroom::Detail::ThreadPool::QueueImpl > queue
Definition: threadpool.hh:161
semaphore.hh
anonymous_namespace{helpers.cc}::passImpl
void passImpl(Semaphore *s)
Definition: helpers.cc:18
A::~A
~A()
Definition: async-deleter-tests.cc:46
create
void create(NewPresentationInterface *interface)
Definition: loader.cc:175
ThreadPool::threads
std::list< ThreadPtr > threads
Definition: threadpool.hh:246
pass
boost::function< void()> pass(Semaphore *s)
Definition: helpers.cc:27
ThreadPool::~ThreadPool
~ThreadPool()
Definition: threadpoolimpl.cc:257
QueueJumper::operator()
void operator()()
Definition: threadpoolimpl.cc:438