Fix concurrency issues on event manager
[src/app-framework-binder.git] / src / jobs.h
1 /*
2  * Copyright (C) 2016, 2017 "IoT.bzh"
3  * Author José Bollo <jose.bollo@iot.bzh>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #pragma once
19
20 struct sd_event;
21
22 extern int jobs_queue0(
23                 void *group,
24                 int timeout,
25                 void (*callback)(int signum));
26
27 extern int jobs_queue(
28                 void *group,
29                 int timeout,
30                 void (*callback)(int signum, void* arg),
31                 void *arg);
32
33 extern int jobs_queue2(
34                 void *group,
35                 int timeout,
36                 void (*callback)(int signum, void* arg1, void *arg2),
37                 void *arg1,
38                 void *arg2);
39
40 extern int jobs_queue3(
41                 void *group,
42                 int timeout,
43                 void (*callback)(int signum, void* arg1, void *arg2, void *arg3),
44                 void *arg1,
45                 void *arg2,
46                 void *arg3);
47
48 extern int jobs_invoke0(
49                 int timeout,
50                 void (*callback)(int signum));
51
52 extern int jobs_invoke(
53                 int timeout,
54                 void (*callback)(int signum, void* arg),
55                 void *arg);
56
57 extern int jobs_invoke2(
58                 int timeout,
59                 void (*callback)(int signum, void* arg1, void *arg2),
60                 void *arg1,
61                 void *arg2);
62
63 extern int jobs_invoke3(
64                 int timeout,
65                 void (*callback)(int signum, void* arg1, void *arg2, void *arg3),
66                 void *arg1,
67                 void *arg2,
68                 void *arg3);
69
70 extern struct sd_event *jobs_get_sd_event();
71
72 extern int jobs_init(int allowed_count, int start_count, int waiter_count);
73 extern int jobs_add_me();
74 extern void jobs_terminate();
75
76