From 25818ef5685b1ae3ca7ee298f3d868a92e2ca8a8 Mon Sep 17 00:00:00 2001 From: retoor Date: Wed, 4 Dec 2024 23:10:45 +0100 Subject: [PATCH] Update with threads. --- isspam | Bin 37312 -> 37416 bytes retoor_c/isspam.c | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/isspam b/isspam index 2674267526a8be2f1ee52c578cc2793050925b6d..e583ca8e3320d69c61abab11e0bdd2d98bdc0c04 100755 GIT binary patch delta 9551 zcmZu%4O~@Kwm;{>K|tVM6uev&0lgr~H;UgV7f}y#QA|)2Nv$L;R4hO(4eeriyxtjX zHI-9S`kOv%UQIeU_A!;1X3pz5p*54HDe6>*NJX>M#=7sn&W8~19e=X+`mc|@_S)<0 zz0Wzf<&TzKFIt*nB0HUecID|rSh{W4E1|)WIu{(d?Thr#^+R=T{ZQ&7rn@r3b=IVU zP3J|BApCEw*7=^aCQ!#0(MHi8sTx|hDZMIwl8`xD*Xc=1**UIK+HRSd(9^TYX9nn6 znG_PRGOA+aRr!RGLQlm9-kMGtEqGg3I>A542J zeaY4 zlG-~^2*AG}WFe3$L+lOpaA(Y-Q0rJ0!V|f{z@nBd!-Px1R)gQW?J3N1pzxHz*Y#)p z0AZ)W_to?*!t3DqGAAckXNA^8y>Y@Q0N{f(q}8azwl0B&H&JA0h8Re$P`e}i4&6Aj zMyICJC|U)n!;t3nkjBwYNQWBIk{;4jItFQmAzjo%noVMFJGJ7LsOcdYLs`A;j!A~y zh91&sv>4JEhP0`Nw2ZbvT4_jk^pIB30Z6M2>FyrVhv^EWj~ddJ9#Vx8!t9RU8q(Gt z(x+(_q%RoKwjR=5v=P!b3~6T%>0a6c>AQwhSoP}}I6~*b?9>((9BJzzIYp7-cE<(7 zF20BK61gC~Wk@r7NCRk9c!fBCjzWiTQS-_(^dta7=;v^IxKTWsLMJ6e*u!tE(6xJk zSST&RP75N!!h=_Kp+Qs$bSu!9ZfG$1fW8Yfxf>cv?*aV|=$LM37+nN9&>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$a2GVeVLex~ET-$rY(hsmg}jg|)DNKHFDyyQ&}?4RP4~kz zg6qj`>-P5RC|!TSX1`$sO47{LTNp(X#lL8?NBe8OwYo1<_3A?tz-B^aUA2v^ytpQ4 zf*V3BU$hnF=xjZnDcRLW6I`TTW3592^xom}bbIzo4!h=Sf}74V;VbCei)r>ZU}HgB zj5l<;3HJ`O$@o~0;Cn>Fjkd78OC8dF8vX~}?GW=SItMm_vvU!Z8f>gOH*_yf_hOp_ zyY8v>J-OGr^{1Wq6*hY^_CHovUZ!TfR1Y_Tu{Do_Wp!D))%CRQRhzGQeWeMmLdPxo zRC!a!-G;qW18(W~A6R_B{(t)C&#FB~fh!{HALzc#IKQ&%vL?8lbbWqZt4jnfIX#J3$p#gn$JcL%hWaInOIecSZeaU8jidhPwICkhJ zx|pZhyuiLQ-hd73w>Z7u;`FRG>$SAvCoFbt(**ai>U)BH+pnv>J-PC3d!-0{I{(jxNo4aATa zs0e5xj%(~Pq)5`5wBSk|t)#tchK4lj8ryk1Ln4d~$&d|HfV#>_TkYhPNkHZ{c98nHI*TU&_TFxZPsCuu

7pW_^^-N!kmV$K z(}In^Qyizg-k~(?6$=Huk{)cVr5)saW$1%_)!1L-8l_hhfj>mjx}m|PHCos{^x3+h K{9@u??f1X0sz^cr diff --git a/retoor_c/isspam.c b/retoor_c/isspam.c index ee5d288..95370f9 100644 --- a/retoor_c/isspam.c +++ b/retoor_c/isspam.c @@ -308,21 +308,21 @@ void analyze_file(char *path) { printf("File doesn't exist: %s\n",path); } } +void * analyze_file_thread(void *path){ + analyze_file((char *)path); + return NULL; +} int main(int argc, char *argv[]) { - if (argc > 1) { + pthread_t *threads = (pthread_t *)malloc(argc * sizeof(pthread_t)); for (int i = 1; i < argc; i++) { - pid_t pid = fork(); - if(!pid){ - printf("File: %s\n", argv[i]); - - analyze_file(argv[i]); - printf("\n"); - return 0; - } + pthread_create(&threads[i-1],NULL,analyze_file_thread,(void *)argv[i]); } - + for(int i = 1; i < argc; i++){ + pthread_join(threads[i-1],NULL); + } + free(threads); return 0; } analyze(stdin);