summaryrefslogtreecommitdiff
path: root/accel-pptpd/triton/loader.c
diff options
context:
space:
mode:
authorKozlov Dmitry <dima@server>2010-08-03 13:28:53 +0400
committerKozlov Dmitry <dima@server>2010-08-03 13:28:53 +0400
commit5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f (patch)
treee72134e47e1491580af15e3eccbba451f13fdd42 /accel-pptpd/triton/loader.c
parentba8e1a64e75930a161afac9048e7d03b7f880644 (diff)
downloadaccel-ppp-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.tar.gz
accel-ppp-5a2d6079eba1c7e2a9479cb10d714b5a97bbfe4f.zip
initiating work on accel-pptpd, replacement of modified poptop
Diffstat (limited to 'accel-pptpd/triton/loader.c')
-rw-r--r--accel-pptpd/triton/loader.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/accel-pptpd/triton/loader.c b/accel-pptpd/triton/loader.c
new file mode 100644
index 00000000..33d48315
--- /dev/null
+++ b/accel-pptpd/triton/loader.c
@@ -0,0 +1,55 @@
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <pthread.h>
+
+#include "conf_file.h"
+#include "triton_p.h"
+
+void md_init(void);
+void event_init(void);
+void timer_init(void);
+
+struct thread_arg_t
+{
+ int (*post_init)(void*);
+ void *arg;
+};
+
+void *thread(struct thread_arg_t *arg)
+{
+ printf("triton: starting new thread\n");
+ #ifdef USE_CORO
+ coroutine_init();
+ #endif
+ md_init();
+ event_init();
+ timer_init();
+
+ arg->post_init(arg->arg);
+
+ free(arg);
+
+ //conf_file_load(cf_name);
+ #ifdef USE_CORO
+ schedule();
+ #else
+ md_run();
+ #endif
+
+ return NULL;
+}
+
+int triton_init(const char *conf_file)
+{
+ return 0;
+}
+int triton_run(int (*post_init)(void*),void *arg)
+{
+ pthread_t thr;
+ struct thread_arg_t *thr_arg=malloc(sizeof(*thr_arg));
+ thr_arg->post_init=post_init;
+ thr_arg->arg=arg;
+ return pthread_create(&thr,NULL,(void*(*)(void*))thread,thr_arg);
+}