-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdispatch.h
More file actions
47 lines (36 loc) · 990 Bytes
/
dispatch.h
File metadata and controls
47 lines (36 loc) · 990 Bytes
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// dispatch.h
// dispatch
//
// Created by Max on 30.06.13.
// Copyright (c) 2013 Max Lunin. All rights reserved.
//
#ifndef __dispatch__
#define __dispatch__
#include <functional>
#include <memory>
#include <queue>
namespace dispatch
{
typedef std::function<void ()> function;
struct queue
{
typedef long priority;
const priority queue_priority;
static std::shared_ptr<queue> main_queue();
virtual void async(function) const;
queue(queue::priority priority) : queue_priority(priority) {};
};
namespace QUEUE_PRIORITY
{
queue::priority const HIGH = 2;
queue::priority const DEFAULT = 0;
queue::priority const LOW = (-2);
queue::priority const BACKGROUND = (-255);
};
void exit();
void main_loop(dispatch::function main_loop_function);
void process_main_loop();
void set_main_loop_process_callback(dispatch::function callback);
}
#endif