boost::ui::call_async — Calls f in the idle time in UI thread. This function is thread safe.
// In header: <boost/ui/thread.hpp> template<typename F, class ... Args> void call_async(F && f, Args &&... args);
See Also:
Thread safety (Wikipedia)