Browse code

core: async_workers - new core parameter

- specify how many processes to create for asyn framework
- default is 0 (asyn framework disabled)
- you must set it to >0 to enable it

Daniel-Constantin Mierla authored on 14/04/2014 12:17:36
Showing 4 changed files
... ...
@@ -392,6 +392,7 @@ MAXBUFFER maxbuffer
392 392
 SQL_BUFFER_SIZE sql_buffer_size
393 393
 CHILDREN children
394 394
 SOCKET_WORKERS socket_workers
395
+ASYNC_WORKERS async_workers
395 396
 CHECK_VIA	check_via
396 397
 PHONE2TEL	phone2tel
397 398
 MEMLOG		"memlog"|"mem_log"
... ...
@@ -775,6 +776,7 @@ IMPORTFILE      "import_file"
775 775
 <INITIAL>{SQL_BUFFER_SIZE}	{ count(); yylval.strval=yytext; return SQL_BUFFER_SIZE; }
776 776
 <INITIAL>{CHILDREN}	{ count(); yylval.strval=yytext; return CHILDREN; }
777 777
 <INITIAL>{SOCKET_WORKERS}	{ count(); yylval.strval=yytext; return SOCKET_WORKERS; }
778
+<INITIAL>{ASYNC_WORKERS}	{ count(); yylval.strval=yytext; return ASYNC_WORKERS; }
778 779
 <INITIAL>{CHECK_VIA}	{ count(); yylval.strval=yytext; return CHECK_VIA; }
779 780
 <INITIAL>{PHONE2TEL}	{ count(); yylval.strval=yytext; return PHONE2TEL; }
780 781
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
... ...
@@ -141,6 +141,7 @@
141 141
 #include "rvalue.h"
142 142
 #include "sr_compat.h"
143 143
 #include "msg_translator.h"
144
+#include "async_task.h"
144 145
 
145 146
 #include "ppcfg.h"
146 147
 #include "pvapi.h"
... ...
@@ -439,6 +440,7 @@ extern char *finame;
439 439
 %token STAT
440 440
 %token CHILDREN
441 441
 %token SOCKET_WORKERS
442
+%token ASYNC_WORKERS
442 443
 %token CHECK_VIA
443 444
 %token PHONE2TEL
444 445
 %token MEMLOG
... ...
@@ -938,6 +940,8 @@ assign_stm:
938 938
 	| CHILDREN EQUAL error { yyerror("number expected"); }
939 939
 	| SOCKET_WORKERS EQUAL NUMBER { socket_workers=$3; }
940 940
 	| SOCKET_WORKERS EQUAL error { yyerror("number expected"); }
941
+	| ASYNC_WORKERS EQUAL NUMBER { async_task_set_workers($3); }
942
+	| ASYNC_WORKERS EQUAL error { yyerror("number expected"); }
941 943
 	| CHECK_VIA EQUAL NUMBER { check_via=$3; }
942 944
 	| CHECK_VIA EQUAL error { yyerror("boolean value expected"); }
943 945
 	| PHONE2TEL EQUAL NUMBER { phone2tel=$3; }
... ...
@@ -190,6 +190,7 @@
190 190
 #include "pv_core.h" /* register core pvars */
191 191
 #include "ppcfg.h"
192 192
 #include "sock_ut.h"
193
+#include "async_task.h"
193 194
 
194 195
 #ifdef DEBUG_DMALLOC
195 196
 #include <dmalloc.h>
... ...
@@ -65,6 +65,7 @@
65 65
 #include "rpc_lookup.h"
66 66
 #include "sr_compat.h"
67 67
 #include "ppcfg.h"
68
+#include "async_task.h"
68 69
 
69 70
 #include <sys/stat.h>
70 71
 #include <regex.h>
... ...
@@ -842,6 +843,9 @@ int init_modules(void)
842 842
 {
843 843
 	struct sr_module* t;
844 844
 
845
+	if(async_task_init()<0)
846
+		return -1;
847
+
845 848
 	for(t = modules; t; t = t->next) {
846 849
 		if (t->exports.init_f) {
847 850
 			if (t->exports.init_f() != 0) {
... ...
@@ -891,6 +895,8 @@ int init_child(int rank)
891 891
 	}
892 892
 	DBG("init_child: initializing %s with rank %d\n", type, rank);
893 893
 
894
+	if(async_task_child_init(rank)<0)
895
+		return -1;
894 896
 
895 897
 	for(t = modules; t; t = t->next) {
896 898
 		if (t->exports.init_child_f) {
... ...
@@ -945,6 +951,9 @@ static int init_mod_child( struct sr_module* m, int rank )
945 945
  */
946 946
 int init_child(int rank)
947 947
 {
948
+	if(async_task_child_init(rank)<0)
949
+		return -1;
950
+
948 951
 	return init_mod_child(modules, rank);
949 952
 }
950 953
 
... ...
@@ -991,6 +1000,9 @@ int init_modules(void)
991 991
 	struct sr_module* t;
992 992
 	int i;
993 993
 	
994
+	if(async_task_init()<0)
995
+		return -1;
996
+
994 997
 	i = init_mod(modules);
995 998
 	if(i!=0)
996 999
 		return i;