foobar2000 SDK
2015-08-03
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
foobar2000
SDK
main_thread_callback.cpp
Go to the documentation of this file.
1
#include "
foobar2000.h
"
2
3
4
void
main_thread_callback::callback_enqueue
() {
5
static_api_ptr_t< main_thread_callback_manager >
()->add_callback(
this
);
6
}
7
8
void
main_thread_callback_add
(main_thread_callback::ptr ptr) {
9
static_api_ptr_t<main_thread_callback_manager>
()->add_callback(ptr);
10
}
11
12
namespace
{
13
typedef
std::function<void ()> func_t;
14
class
mtcallback_func :
public
main_thread_callback
{
15
public
:
16
mtcallback_func(func_t
const
& f) : m_f(f) {}
17
18
void
callback_run
() {
19
m_f();
20
}
21
22
private
:
23
func_t m_f;
24
};
25
}
26
27
void
fb2k::inMainThread
( std::function<
void
() > f ) {
28
main_thread_callback_add
(
new
service_impl_t<mtcallback_func>
(f));
29
}
service_impl_t
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
Definition:
service_impl.h:4
main_thread_callback_add
void main_thread_callback_add(main_thread_callback::ptr ptr)
Definition:
main_thread_callback.cpp:8
main_thread_callback::callback_enqueue
void callback_enqueue()
Definition:
main_thread_callback.cpp:4
fb2k::inMainThread
void inMainThread(std::function< void() > f)
Definition:
main_thread_callback.cpp:27
foobar2000.h
main_thread_callback::callback_run
virtual void callback_run()=0
Gets called from main app thread. See main_thread_callback_manager description for more info...
static_api_ptr_t
Helper template used to easily access core services. Usage: static_api_ptr_t<myclass> api; api->doso...
Definition:
service.h:533
main_thread_callback
Callback object class for main_thread_callback_manager service.
Definition:
main_thread_callback.h:4
Generated by
1.8.11