Mercurial > hg > Gears > Gears
changeset 1010:906ad9656e7a
tweak socket_wc
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 13 Jan 2022 19:39:04 +0900 |
parents | 2c73de738917 |
children | ea620dff804c |
files | src/parallel_execution/examples/socketQueue/Local_test.cbc src/parallel_execution/examples/socketQueue/Remote_test.cbc |
diffstat | 2 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/examples/socketQueue/Local_test.cbc Thu Jan 13 03:24:14 2022 +0900 +++ b/src/parallel_execution/examples/socketQueue/Local_test.cbc Thu Jan 13 19:39:04 2022 +0900 @@ -3,6 +3,7 @@ #interface "Integer.h" #interface "FileString.h" #interface "DataTransfer.h" +char* service_num; __code Task1(TQueue* localDGMQueue){ Integer* integer = NEW(Integer); @@ -16,7 +17,6 @@ } __code Task2(TQueue* localDGMQueue){ - printf("Task2\n"); goto localDGMQueue->take(Task3); } @@ -28,7 +28,6 @@ __code Task3(TQueue* localDGMQueue, FileString* string){ printf("take[%s]\n", string->str); - printf("Task3_exit\n"); goto localDGMQueue->isEmpty(noEmp, whenEmp); } @@ -39,13 +38,20 @@ } __code whenEmp(TQueue* localDGMQueue){ - printf("iEmpty\n"); + printf("iEmpty & end\n"); goto exit_code(); } __code noEmp(TQueue* localDGMQueue){ - printf("noEmp\n"); - goto exit_code(); + goto Task2(); +} + +void init(int argc, char** argv) { + for (int i = 1; argv[i]; ++i) { + if (strcmp(argv[i], "-sn") == 0){ + service_num = argv[i+1]; + } + } } int main(int argc, char** argv) {
--- a/src/parallel_execution/examples/socketQueue/Remote_test.cbc Thu Jan 13 03:24:14 2022 +0900 +++ b/src/parallel_execution/examples/socketQueue/Remote_test.cbc Thu Jan 13 19:39:04 2022 +0900 @@ -7,7 +7,7 @@ __code Task1(TQueue* remoteDGMQueue){ FileString* string = NEW(FileString); char word[1024] = "first"; - memcpy(string->str, word, sizeof(word)); + memcpy(string->str, word, strlen(word)); goto remoteDGMQueue->put(string, Task2); } @@ -20,7 +20,7 @@ printf("Task2\n"); FileString* string = NEW(FileString); char word[1024] = "secound"; - memcpy(string->str, word, sizeof(word)); + memcpy(string->str, word, strlen(word)); goto remoteDGMQueue->put(string, Task3); } @@ -33,7 +33,7 @@ printf("Task3\n"); FileString* string = NEW(FileString); char word[1024] = "finish"; - memcpy(string->str, word, sizeof(word)); + memcpy(string->str, word, strlen(word)); goto remoteDGMQueue->put(string, Task4); ; }