summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-02-06 16:19:17 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2018-02-06 16:20:49 +0100
commit098d6d3c8fb0aff78528746115d0f481da76e5fb (patch)
tree692a17d8f7a706cc7257bfe54aa4d4623cee0fc6
parent4c7b7d3adcc10fbcf64d790a4e7c194ff3d5c6de (diff)
jobs: Add argument to start
Change-Id: I89a75a036c60097fb898ab8723007ca6ebfc7f39 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/jobs.c4
-rw-r--r--src/jobs.h7
-rw-r--r--src/main.c4
3 files changed, 10 insertions, 5 deletions
diff --git a/src/jobs.c b/src/jobs.c
index 4b4472e5..952720bd 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -732,7 +732,7 @@ struct sd_event *jobs_get_sd_event()
* @param start The start routine to activate (can't be NULL)
* @return 0 in case of success or -1 in case of error.
*/
-int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)(int signum))
+int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)(int signum, void* arg), void *arg)
{
int rc, launched;
struct thread me;
@@ -782,7 +782,7 @@ int jobs_start(int allowed_count, int start_count, int waiter_count, void (*star
}
/* queue the start job */
- job = job_create(NULL, 0, (job_cb_t)start, NULL);
+ job = job_create(NULL, 0, start, arg);
if (!job) {
ERROR("out of memory");
errno = ENOMEM;
diff --git a/src/jobs.h b/src/jobs.h
index e61b2c70..7be9e69e 100644
--- a/src/jobs.h
+++ b/src/jobs.h
@@ -44,5 +44,10 @@ extern struct sd_event *jobs_get_sd_event();
extern void jobs_terminate();
-extern int jobs_start(int allowed_count, int start_count, int waiter_count, void (*start)(int signum));
+extern int jobs_start(
+ int allowed_count,
+ int start_count,
+ int waiter_count,
+ void (*start)(int signum, void* arg),
+ void *arg);
diff --git a/src/main.c b/src/main.c
index df35d88d..952b4868 100644
--- a/src/main.c
+++ b/src/main.c
@@ -535,7 +535,7 @@ static void run_startup_calls()
| job for starting the daemon
+--------------------------------------------------------- */
-static void start(int signum)
+static void start(int signum, void *arg)
{
struct afb_hsrv *hsrv;
@@ -674,7 +674,7 @@ int main(int argc, char *argv[])
afb_debug("main-start");
/* enter job processing */
- jobs_start(3, 0, 50, start);
+ jobs_start(3, 0, 50, start, NULL);
WARNING("hoops returned from jobs_enter! [report bug]");
return 1;
}