Hi

Series edited to add the argument to worker_spawn instead of a new function.

- Lauri
>From f4b4f2701c63663ffea85cfb077076736f50ee86 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Thu, 14 Jun 2012 17:45:25 +0300
Subject: [PATCH 1/2] utils: Make worker_spawn take the void *argument


Signed-off-by: Lauri Kasanen <[email protected]>
---
 src/include/mk_plugin.h |    2 +-
 src/include/mk_utils.h  |    2 +-
 src/mk_utils.c          |    4 ++--
 src/monkey.c            |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/include/mk_plugin.h b/src/include/mk_plugin.h
index 68ef7fc..a08afb2 100644
--- a/src/include/mk_plugin.h
+++ b/src/include/mk_plugin.h
@@ -269,7 +269,7 @@ struct plugin_api
                                                       int);
 
     /* worker's functions */
-    pthread_t (*worker_spawn) (void (*func) (void *));
+    pthread_t (*worker_spawn) (void (*func) (void *), void *);
     int (*worker_rename) (const char *);
 
     /* event's functions */
diff --git a/src/include/mk_utils.h b/src/include/mk_utils.h
index b78a26b..3f38b71 100644
--- a/src/include/mk_utils.h
+++ b/src/include/mk_utils.h
@@ -82,7 +82,7 @@ int mk_utils_remove_pid(void);
 
 void mk_print(int type, const char *format, ...) PRINTF_WARNINGS(2,3);
 
-pthread_t mk_utils_worker_spawn(void (*func) (void *));
+pthread_t mk_utils_worker_spawn(void (*func) (void *), void *arg);
 int mk_utils_worker_rename(const char *title);
 
 #ifdef DEBUG
diff --git a/src/mk_utils.c b/src/mk_utils.c
index e3397d5..b031331 100644
--- a/src/mk_utils.c
+++ b/src/mk_utils.c
@@ -595,14 +595,14 @@ void mk_print(int type, const char *format, ...)
     fflush(stdout);
 }
 
-pthread_t mk_utils_worker_spawn(void (*func) (void *))
+pthread_t mk_utils_worker_spawn(void (*func) (void *), void *arg)
 {
     pthread_t tid;
     pthread_attr_t thread_attr;
 
     pthread_attr_init(&thread_attr);
     pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED);
-    if (pthread_create(&tid, &thread_attr, (void *) func, NULL) < 0) {
+    if (pthread_create(&tid, &thread_attr, (void *) func, arg) < 0) {
         perror("pthread_create");
         exit(EXIT_FAILURE);
     }
diff --git a/src/monkey.c b/src/monkey.c
index 18fe4e3..1ccb048 100644
--- a/src/monkey.c
+++ b/src/monkey.c
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
     mk_clock_sequential_init();
 
     /* Workers: logger and clock */
-    mk_utils_worker_spawn((void *) mk_clock_worker_init);
+    mk_utils_worker_spawn((void *) mk_clock_worker_init, NULL);
 
     /* Init mk pointers */
     mk_mem_pointers_init();
-- 
1.7.2.1

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to