Go to the documentation of this file.
39 #ifndef CGU_TASK_MANAGER_H
40 #define CGU_TASK_MANAGER_H
62 virtual const char*
what()
const throw() {
return "TaskError\n";}
885 std::auto_ptr<const Callback::Callback> a1(task);
886 std::auto_ptr<const Callback::Callback> a2;
955 void add_task(std::auto_ptr<const Callback::Callback> task,
956 std::auto_ptr<const Callback::Callback> fail);
1019 template <
class Ret,
class T>
1070 template <
class Ret,
class Arg1,
class T>
1072 Ret (T::*func)(Arg1),
1125 template <
class Ret,
class Arg1,
class Arg2,
class T>
1127 Ret (T::*func)(Arg1, Arg2),
1246 template <
class Ret,
class T>
1249 std::auto_ptr<const Cgu::Callback::Callback> fail,
1252 GMainContext* context,
1378 template <
class Ret,
class Arg1,
class T>
1381 std::auto_ptr<const Cgu::Callback::Callback> fail,
1384 GMainContext* context,
1386 Ret (T::*func)(Arg1),
1514 template <
class Ret,
class Arg1,
class Arg2,
class T>
1517 std::auto_ptr<const Cgu::Callback::Callback> fail,
1520 GMainContext* context,
1522 Ret (T::*func)(Arg1, Arg2),
1597 template <
class Ret,
class T>
1599 GMainContext* context,
1604 std::auto_ptr<const Cgu::Callback::Callback>(),
1690 template <
class Ret,
class Arg1,
class T>
1692 GMainContext* context,
1694 Ret (T::*func)(Arg1),
1698 std::auto_ptr<const Cgu::Callback::Callback>(),
1788 template <
class Ret,
class Arg1,
class Arg2,
class T>
1790 GMainContext* context,
1792 Ret (T::*func)(Arg1, Arg2),
1797 std::auto_ptr<const Cgu::Callback::Callback>(),
1849 template <
class Ret,
class T>
1851 Ret (T::*func)()
const);
1900 template <
class Ret,
class Arg1,
class T>
1902 Ret (T::*func)(Arg1)
const,
1955 template <
class Ret,
class Arg1,
class Arg2,
class T>
1957 Ret (T::*func)(Arg1, Arg2)
const,
2076 template <
class Ret,
class T>
2079 std::auto_ptr<const Cgu::Callback::Callback> fail,
2082 GMainContext* context,
2084 Ret (T::*func)()
const);
2208 template <
class Ret,
class Arg1,
class T>
2211 std::auto_ptr<const Cgu::Callback::Callback> fail,
2214 GMainContext* context,
2216 Ret (T::*func)(Arg1)
const,
2344 template <
class Ret,
class Arg1,
class Arg2,
class T>
2347 std::auto_ptr<const Cgu::Callback::Callback> fail,
2350 GMainContext* context,
2352 Ret (T::*func)(Arg1, Arg2)
const,
2427 template <
class Ret,
class T>
2429 GMainContext* context,
2431 Ret (T::*func)()
const) {
2434 std::auto_ptr<const Cgu::Callback::Callback>(),
2520 template <
class Ret,
class Arg1,
class T>
2522 GMainContext* context,
2524 Ret (T::*func)(Arg1)
const,
2528 std::auto_ptr<const Cgu::Callback::Callback>(),
2618 template <
class Ret,
class Arg1,
class Arg2,
class T>
2620 GMainContext* context,
2622 Ret (T::*func)(Arg1, Arg2)
const,
2627 std::auto_ptr<const Cgu::Callback::Callback>(),
2676 template <
class Ret>
2723 template <
class Ret,
class Arg1>
2772 template <
class Ret,
class Arg1,
class Arg2>
2889 template <
class Ret>
2892 std::auto_ptr<const Cgu::Callback::Callback> fail,
2895 GMainContext* context,
3017 template <
class Ret,
class Arg1>
3020 std::auto_ptr<const Cgu::Callback::Callback> fail,
3023 GMainContext* context,
3147 template <
class Ret,
class Arg1,
class Arg2>
3150 std::auto_ptr<const Cgu::Callback::Callback> fail,
3153 GMainContext* context,
3154 Ret (*func)(Arg1, Arg2),
3226 template <
class Ret>
3228 GMainContext* context,
3232 std::auto_ptr<const Cgu::Callback::Callback>(),
3315 template <
class Ret,
class Arg1>
3317 GMainContext* context,
3322 std::auto_ptr<const Cgu::Callback::Callback>(),
3407 template <
class Ret,
class Arg1,
class Arg2>
3409 GMainContext* context,
3410 Ret (*func)(Arg1, Arg2),
3415 std::auto_ptr<const Cgu::Callback::Callback>(),
3496 TaskManager(
unsigned int max = 8,
unsigned int min = 0,
3497 unsigned int idle = 10000,
bool blocking =
true,
3621 #include <c++-gtk-utils/task_manager.tpp>
Struct for automatic typing of parameter arguments for template functions.
Definition: param.h:79
StopMode
Definition: task_manager.h:518
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, T &t, Ret(T::*func)(Arg1, Arg2), typename Cgu::Param< Arg1 >::ParamType arg1, typename Cgu::Param< Arg2 >::ParamType arg2)
Definition: task_manager.h:1789
The callback interface class.
Definition: callback.h:904
Definition: application.h:45
virtual const char * what() const
Definition: task_manager.h:62
Definition: task_manager.h:61
void set_max_threads(unsigned int max)
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, const T &t, Ret(T::*func)(Arg1, Arg2) const, typename Cgu::Param< Arg1 >::ParamType arg1, typename Cgu::Param< Arg2 >::ParamType arg2)
Definition: task_manager.h:2619
void make_task_when_full(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, Cgu::Releaser *when_releaser, std::auto_ptr< const Cgu::Callback::Callback > fail, Cgu::Releaser *fail_releaser, gint priority, GMainContext *context, T &t, Ret(T::*func)())
unsigned int get_idle_time() const
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, const T &t, Ret(T::*func)() const)
Definition: task_manager.h:2428
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, Ret(*func)(Arg1), typename Cgu::Param< Arg1 >::ParamType arg1)
Definition: task_manager.h:3316
This file provides classes encapsulating callbacks.
bool get_blocking() const
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, Ret(*func)())
Definition: task_manager.h:3227
Cgu::SharedLockPtr< Cgu::AsyncResult< Ret > > make_task_result(T &t, Ret(T::*func)())
A scoped locking class for exception safe Mutex locking which tracks the status of its mutex.
Definition: mutex.h:303
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, T &t, Ret(T::*func)(Arg1), typename Cgu::Param< Arg1 >::ParamType arg1)
Definition: task_manager.h:1691
unsigned int get_min_threads() const
This file provides thread-safe asynchronous queue classes.
unsigned int get_used_threads() const
unsigned int get_tasks() const
static unsigned int get_max_tasks()
SafeFunctorArg< void > SafeFunctor
Definition: callback.h:1080
void set_idle_time(unsigned int idle)
IncHandle(TaskManager &tm_)
Definition: task_manager.h:3603
This file provides a thread-safe asynchronous result class.
Functor class holding a Callback::CallbackArg object, with thread-safe reference count.
Definition: callback.h:1078
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, T &t, Ret(T::*func)())
Definition: task_manager.h:1598
@ wait_for_all
Definition: task_manager.h:518
#define CGU_GLIB_MEMORY_SLICES_FUNCS
Definition: cgu_config.h:84
void set_stop_mode(StopMode mode)
Provides wrapper classes for pthread mutexes and condition variables, and scoped locking classes for ...
This is a smart pointer for managing the lifetime of objects allocated on freestore,...
Definition: shared_ptr.h:513
void change_max_threads(int delta)
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, const T &t, Ret(T::*func)(Arg1) const, typename Cgu::Param< Arg1 >::ParamType arg1)
Definition: task_manager.h:2521
A scoped handle for exception safe incrementing of the maximum number of threads that a TaskManager o...
Definition: task_manager.h:3575
A class used for tracking EmitterArg and SafeEmitterArg connections.
Definition: emitter.h:368
void add_task(const Callback::Callback *task)
Definition: task_manager.h:882
StopMode get_stop_mode() const
~IncHandle()
Definition: task_manager.h:3614
void make_task_when(std::auto_ptr< const Cgu::Callback::CallbackArg< const Ret & > > when, GMainContext *context, Ret(*func)(Arg1, Arg2), typename Cgu::Param< Arg1 >::ParamType arg1, typename Cgu::Param< Arg2 >::ParamType arg2)
Definition: task_manager.h:3408
This file provides a thread-safe signal/slot mechanism, with automatic disconnection.
A thread-pool class for managing tasks in multi-threaded programs.
Definition: task_manager.h:516
void set_blocking(bool blocking)
@ wait_for_running
Definition: task_manager.h:518
unsigned int get_max_threads() const