Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gui_thread_apple.mm « platform - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f2379bd7f5ddcc7c84f2e9bca23e3cca53455650 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "platform/gui_thread.hpp"

#include <memory>
#include <utility>

#import <Foundation/Foundation.h>

namespace
{
void PerformImpl(void * task)
{
  using base::TaskLoop;
  std::unique_ptr<TaskLoop::Task> t(reinterpret_cast<TaskLoop::Task *>(task));
  (*t)();
}
}

namespace platform
{
bool GuiThread::Push(Task && task)
{
  dispatch_async_f(dispatch_get_main_queue(), new Task(std::move(task)), &PerformImpl);
  return true;
}

bool GuiThread::Push(Task const & task)
{
  dispatch_async_f(dispatch_get_main_queue(), new Task(task), &PerformImpl);
  return true;
}
}  // namespace platform