hewei.it 4 ani în urmă
părinte
comite
deb8dcb99c
1 a modificat fișierele cu 16 adăugiri și 3 ștergeri
  1. 16 3
      examples/hmain_test.cpp

+ 16 - 3
examples/hmain_test.cpp

@@ -2,6 +2,19 @@
 #include "hmain.h"
 #include "hmain.h"
 #include "iniparser.h"
 #include "iniparser.h"
 
 
+/*
+ * @build: make examples
+ * @usage: bin/hmain_test -h
+ *         bin/hmain_test -v
+ *
+ *         bin/hmain_test -c etc/hmain_test.conf -d
+ *         ps aux | grep hmain_test
+ *
+ *         bin/hmain_test -s stop
+ *         ps aux | grep hmain_test
+ *
+ */
+
 typedef struct conf_ctx_s {
 typedef struct conf_ctx_s {
     IniParser* parser;
     IniParser* parser;
     int loglevel;
     int loglevel;
@@ -215,15 +228,15 @@ int main(int argc, char** argv) {
     // pidfile
     // pidfile
     create_pidfile();
     create_pidfile();
 
 
-    master_workers_run(worker_fn, (void*)(intptr_t)100L, g_conf_ctx.worker_processes, g_conf_ctx.worker_threads);
+    master_workers_run(worker_fn, (void*)(intptr_t)g_conf_ctx.port, g_conf_ctx.worker_processes, g_conf_ctx.worker_threads);
 
 
     return 0;
     return 0;
 }
 }
 
 
 void worker_fn(void* userdata) {
 void worker_fn(void* userdata) {
-    long num = (long)(intptr_t)(userdata);
+    long port = (long)(intptr_t)(userdata);
     while (1) {
     while (1) {
-        printf("num=%ld pid=%ld tid=%ld\n", num, hv_getpid(), hv_gettid());
+        printf("port=%ld pid=%ld tid=%ld\n", port, hv_getpid(), hv_gettid());
         hv_delay(60000);
         hv_delay(60000);
     }
     }
 }
 }