Hi

This is one of the last non-lib changes.

- Lauri
>From 08c58904d75311cfeea23a0d496efeb86f1ddb75 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Tue, 7 Aug 2012 12:05:47 +0300
Subject: [PATCH] cheetah: Remove some duplicated code by using worker_spawn


Signed-off-by: Lauri Kasanen <[email protected]>
---
 plugins/cheetah/cheetah.c |   16 ++--------------
 plugins/cheetah/cheetah.h |    1 -
 2 files changed, 2 insertions(+), 15 deletions(-)

diff --git a/plugins/cheetah/cheetah.c b/plugins/cheetah/cheetah.c
index 40017b3..1bd0f36 100644
--- a/plugins/cheetah/cheetah.c
+++ b/plugins/cheetah/cheetah.c
@@ -97,7 +97,7 @@ static void mk_cheetah_config(char *path)
     }
 }
 
-void *mk_cheetah_init(void *args)
+static void mk_cheetah_init(void *args UNUSED_PARAM)
 {
     /* Rename worker */
     mk_api->worker_rename("monkey: cheetah");
@@ -111,8 +111,6 @@ void *mk_cheetah_init(void *args)
     else if (listen_mode == LISTEN_SERVER) {
         mk_cheetah_loop_server();
     }
-
-    return 0;
 }
 
 /* This function is called when the plugin is loaded, it must
@@ -138,16 +136,6 @@ void _mkp_exit()
 
 int _mkp_core_prctx(struct server_config *config)
 {
-    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 *) mk_cheetah_init, config) < 0) {
-        perror("pthread_create");
-        exit(EXIT_FAILURE);
-    }
-    
+    mk_api->worker_spawn(mk_cheetah_init, config);
     return 0;
 }
diff --git a/plugins/cheetah/cheetah.h b/plugins/cheetah/cheetah.h
index e9c9235..1671f9f 100644
--- a/plugins/cheetah/cheetah.h
+++ b/plugins/cheetah/cheetah.h
@@ -87,7 +87,6 @@ FILE *cheetah_input;
 FILE *cheetah_output;
 
 /* functions */
-void *mk_cheetah_init(void *args);
 void mk_cheetah_welcome_msg();
 
 #endif
-- 
1.7.2.1

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

Reply via email to