多线程对拍(Version 1.0.5 && 2.0.1)
使用指南( OP 修订版)
Guide In English (Provided by Pursuing_OIer)
Muliti Thread Debugging Program 1.0.5 by HANGRY_Sol.All rights reserved.
Guide:
-
Use
g++ while.cpp -o while -lpthread && ./while
at the beginning of the terminal command. -
The following parameters should be written in the following format of
n n s s s s n n
(n
for stands for number whiles
stands for string),
The first number is the number of threads you need. Normally, the more the better, but for your computer's safety,when the input data you use to debug your code is so large, please use less threads.
This number should be from \(1\) to \(50\).
The second number is the number of testcases which needs to be ran for each thread.The total number of testcases if the product of the last two parameters.
The third parameter is the name of program which need debugging.
The fourth is the name of program which is correct (also called "std").
The fifth is the name of the random data generator. All above shoudn't include the suffix
.cpp
.The sixth is the extra-command you want to excute:
f
ActivateSanitizers
(onlyaddress,undefined
).
s
Release the constraint on stack space.If you want to excute both of them, use "fs" or "sf".
Input anything if you don't need any.
The seventh is the time limit (in millisecond).We will throw "Error" to you when your program used more than one thousand milliseconds.
The eighth is the memory limits (in Mib).
-
When your program make error code we will copy all the files you used, it named "WrongIn.in", "WrongOut.out", "WrongDatasCorrectOut.out" and other trash files will be deleted.
-
Sometimes the debugging program may crash, don't worry.Usually you just need to delete the source fileof the debugging program and create new one.
We're sorry for unexpected mistakes.Please leave your proposals in the Comment Area of my blog.
Thanks for using!
使用指南 In Chinese (Provided by Pursuing_OIer)
这里是由Hangry_Sol编写的多线程对拍程序(1.0.5 版本),未经许可不得盗用。
使用指南:
-
运行对拍程序使用的终端命令由
g++ while.cpp -o while -lpthread && ./while
开头。 -
在此之后,请按
n n s s s s n n
的格式输入运行参数(n
表示数字,s
表示字符串):
第一个数字表示使用的线程数。正常情况下这个值越大越好,但请注意,如果数据规模过大,请使用较少的线程数以保护您的计算机。
第二个数字表示每个线程所运行的测试数据组数。总的数据组数为前两个值的乘积。
接下来的三个字符串分别表示您的待对拍程序,正解程序,随机数据生成器程序的文件名(省略扩展名
.cpp
),形如my std rand
。第四个字符串表示额外运行参数。
f
启动 Sanitizers(仅address,undefined
)。
s
不限制栈空间大小。
fs
或sf
同时启动上述两种操作。如果您不想使用上述操作,请输出任意可见字符串占位。
接下来的两个数字分别表示您运行代码的时间限制(单位为毫秒)和空间限制(单位为兆字节),当您的代码运行时间或所用内存超出限制,程序会返回错误信息。
-
当您的程序出现错误,我们将保留使您输出错误答案的数据,输入数据,您的输出和正确输出文件分别名为
WrongIn.in
,WrongOut.out
,WrongDatasCorrectOut.out
,其他文件将被删除。 -
一旦对拍程序崩溃,请您不要慌张。一般情况下您只需要删除对拍程序文件并新建文件保存对拍程序即可解决。
如果对拍程序有误,请您谅解,也欢迎您将发现的错误发送到博客的评论区。
感谢使用!
Code
CODE
/*
Muliti Thread Matching Program 1.0.5 by HANGRY_Sol(https://www.cnblogs.com/hangry) which can't be used without agreement.
---------------------------
Usage Guide:
1. Using terminal-insturction "g++ while.cpp -o while -lpthread && ./while" for prefix. Which you need to fill in by yourself.
2. others you need to write follow this format: ("n" for number while "s" for string)
n n s s s s n n
The first is the threads you need. Normally, the more the better, but caring for you PC, when data you create which is so huge, please make it less.
Matching Program support you make it in 1 to 50.
The second is the data which need runing for each thread.
The third is the name of program which need matching. For instance, the file is "1.cpp", you need input "1".
The fourth is the name of program which is correct (also called "std"). Limits and form methods is the same of 3rd.
The fifth is the name of program which generate random datas. Limits and form methods is the same of 3rd.
The sixth is the extra-instructions you want to add to your program which divide into following two types:
1. "f" Cross border detection, which also called "fsanitize" in the language of "g++"
2. "s" unlimited stack size.
If you demand to use both of them, type in "fs" or "sf". type anything (cannot be empty) when you don't need them.
The seventh is the time limits, the unit is millisecond, which means when you input "1", we will throw "Error message" to you when your program running more than one second.
The eighth is the Memory limits, the unit is Mib.
3. When your program make error code we will copy all the files you used, they are named "WrongIn.in", "WrongOut.out", "WrongDatasCorrectOut.out" and other trash files will be deleted.
4. sometimes Multi threaded processing may be crashed, don't worry sir, you just need to delete this file and create new one, this is usually effective.
---------------------------
Also, we sometimes will occur mistakes.Please leave your proposals in the Comment Area of my blog (https://www.cnblogs.com/hangry/p/18470526).
thanks for using!
*/
#include <bits/stdc++.h>
#include <pthread.h>
#include <unistd.h>
using namespace std;
#define s(x) system(x)
// -lpthread
string Needin, Needout, Rander, More;
string In(int x) {
string s = to_string(x) + ".in";
return s;
}
string Out(int x) {
return to_string(x) + ".out";
}
string Std(int x) {
return "std" + to_string(x) + ".out";
}
int Counts; int Thread_MAX; double sec, TIME_LIMIT, SIZE_LIMIT;
int all; int per[51]; bool Outer;
double times;
int id[51]; int Ender = 0;
pthread_t tids[51]; bool Exiter[51];
struct Messager {
int id, Thread_name, Testcase;
int caser;
double totimes, sec;
} p;
map <int, int> mp;
void Breaker(int x) {
if (!Exiter[x]) {
s(("cp " + In(x) + " WrongIn.in > 0.test").c_str());
s(("cp " + Out(x) + " WrongOut.out > 0.test").c_str());
s(("cp " + Std(x) + " WrongDatasCorrectOut.out > 0.test").c_str());
}
for (int i = 1; i <= Thread_MAX; ++ i) {
if (Exiter[i]) continue;
s(("rm -f " + In(i) + " > 0.test").c_str());
s(("rm -f " + Out(i) + " > 0.test").c_str());
s(("rm -f " + Std(i) + " > 0.test").c_str());
Exiter[i] = 1;
}
s("rm -f 0.test");
}
void* While(void *Point) {
int n = 1000;
int x = *((int *)Point);
for (int i = 1; i <= all; ++ i) {
if (Outer || Exiter[x]) pthread_exit(NULL);
Counts ++;
if (s(("./" + Rander + " > " + In(x) + " 2> 0.test").c_str())) {
p.id = -2, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
times -= clock();
int ret = s(("ulimit -s " + to_string((long long)SIZE_LIMIT) + " && timeout " + to_string(TIME_LIMIT) + "s ./" + Needin + "< " + In(x) + " > " + Out(x) + " 2> 0.test").c_str());
if (Outer || Exiter[x]) pthread_exit(NULL);
if (ret == 31744) {
p.id = 2, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
} else if (ret == 35584) {
p.id = 3, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
} else if (ret) {
p.id = 4, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
times += clock();
if (s(("./" + Needout + " < " + In(x) + " > " + Std(x) + " 2> 0.test").c_str())) {
p.id = -1, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
if (s(("diff " + Out(x) + " " + Std(x) + " -Z > 0.test").c_str())) {
p.id = 1, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
if (Counts % (Thread_MAX * 100) == 0) {
p.caser = Counts, p.sec = clock() * 1.0 / CLOCKS_PER_SEC;
p.totimes = times / Counts / CLOCKS_PER_SEC;
}
}
if (Outer) pthread_exit(NULL);
s(("rm -f " + In(x) + " > 0.test").c_str()), s(("rm -f " + Out(x) + " > 0.test").c_str()), s(("rm -f " + Std(x) + " > 0.test").c_str());
++ Ender; Exiter[x] = 1;
if (Ender == Thread_MAX) {
cout << "\033[1m\033[32mAll test case is Accepted, I will finish right now\033[0m\n";
exit(0);
}
pthread_exit(NULL);
}
void Breakls() {
for (int i = 1; i <= Thread_MAX; ++ i) {
if (Exiter[i]) continue;
s(("rm -f " + In(i) + "> 0.test").c_str()), s(("rm -f " + Out(i) + "> 0.test").c_str()), s(("rm -f " + Std(i) + "> 0.test").c_str());
}
s("rm -f 0.test");
}
void* Printer(void *Point) {
puts("\033[35m\033[1mSystem message:\033[0m\nListener is using.You can input “now” to ask the number of testcases, “clear” for clean your terminal and “exit” for kill all.\n\n --------------------------------");
string s;
while (Ender != Thread_MAX) {
if (Outer == 1) exit(0);
bool now = 1;
for (int i = 1; i <= Thread_MAX; ++ i) now &= Exiter[i];
if (now) exit(0);
cin >> s;
if (s == "now") {
cout << "\033[1m\033[35mNow experience testcase:\033[0m" << Counts << '\n';
} else if (s == "exit") {
cout << "\033[1m\033[35mOk I will kill myself right now.\n\033[0m";
Outer = 1;
usleep(500000); Breakls(); exit(0);
} else if (s == "clear") {
s("clear");
}
}
pthread_exit(NULL);
}
inline void Solve(int argc, char **argv) {
if (argc != 9) {
puts("\033[1m\033[33mCompile Error : parameter-nums error.\033[0m");
exit(0);
}
for (int i = 1; i < argc; ++ i) {
if (i == 1) {
Thread_MAX = atoi(argv[i]);
if (Thread_MAX > 50 || Thread_MAX <= 0) {
puts("\033[1m\033[33mCompile Error : Pthread number cannot be supported\033[0m");
exit(0);
}
} else if (i == 2) {
all = atoi(argv[i]);
if (all < 0) {
puts("\033[1m\033[33mCompile Error : data number cannot be supported\033[0m");
exit(0);
}
} else if (i == 3) {
Needin = argv[i];
if (system(("g++ -O2 " + Needin + ".cpp -o " + Needin).c_str())) {
puts(("\033[1m\033[33mCompile Error : \033[0m" + Needin).c_str());
exit(0);
}
} else if (i == 4) {
Needout = argv[i];
if (system(("g++ -O2 " + Needout + ".cpp -o " + Needout).c_str())) {
puts(("\033[1m\033[33mCompile Error : \033[0m" + Needout).c_str());
exit(0);
}
} else if (i == 5) {
Rander = argv[i];
if (system(("g++ -O2 " + Rander + ".cpp -o " + Rander).c_str())) {
puts(("\033[1m\033[33mCompile Error : \033[0m" + Rander).c_str());
exit(0);
}
} else if (i == 6) {
More = argv[i];
if (More == "fs" || More == "sf") {
system("ulimit -s unlimited");
if (system(("g++ -O2 -fsanitize=address,undefined " + Needin + ".cpp -o " + Needin).c_str())) {
puts(("\033[1m\033[33mCompile Error : \033[0m" + Needin).c_str());
exit(0);
}
} else if (More == "s") {
system("ulimit -s unlimited");
} else if (More == "f") {
if (system(("g++ -O2 -fsanitize=address,undefined " + Needin + ".cpp -o " + Needin).c_str())) {
puts(("\033[1m\033[33mCompile Error : \033[0m" + Needin).c_str());
exit(0);
}
}
} else if (i == 7) {
TIME_LIMIT = atoi(argv[i]) * 1.0 / 1000;
} else SIZE_LIMIT = atoi(argv[i]);
}
s("clear");
puts("\033[1m\033[35mSystem message: \033[0mProgram compares successfully,we will run in just minutes.");
usleep(1000000);
s("clear");
for (int i = 1; i <= Thread_MAX; ++ i) {
s(("touch " + In(i)).c_str());
s(("touch " + Out(i)).c_str());
s(("touch " + Std(i)).c_str());
}
s("touch 0.test");
}
pthread_t printers, Error_reciver;
int numer = 51;
void *Geter(void *Point) {
while (!p.id) {
if (Outer) pthread_exit(NULL);
if (p.caser) {
bool now = 1;
for (int i = 1; i <= Thread_MAX; ++ i) now &= Exiter[i];
if (now) exit(0);
if (mp[p.caser]) {
p.sec = 0, p.caser = 0, p.totimes = 0;
continue;
}
mp[p.caser] = 1;
puts("--------------------------------");
puts("");
sec = clock() * 1.0 / CLOCKS_PER_SEC;
cout << "\033[1m\033[32mAccepted \033[0m" << p.caser << '\n' ;
cout << "\033[1m\033[35mNow expriences \033[0m" << "\033[1m\033[33m" << fixed << setprecision(3) << p.sec << " seconds.\033[0m" << '\n';
cout << "\033[1m\033[35mPer run-time: " << p.totimes << " s.\033[0m\n";
puts("");
p.sec = 0, p.caser = 0, p.totimes = 0;
}
}
usleep(500000);
if (p.id == -2) {
cout << "\033[1m\033[31mRandom Runing :: Break Informations : Rand.cpp break down.\n\033[0m";
} else if (p.id == -1) {
cout << "\033[1m\033[31mStd Wrong :: Break Informations : std.cpp break down.\n\033[0m";
} else if (p.id == 1) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[31mWrong on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 2) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[33mTime Limit Error on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 3) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[33mMemory Limit Error on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 4) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[31mRuntime Error on Test " << p.Testcase << "\033[0m\n";
}
Breaker(p.Thread_name);
exit(0);
pthread_exit(NULL);
}
signed main(int argc, char ** argv) {
Solve(argc, argv);
pthread_create(&printers, NULL, Printer, (void *)&(id[0]));
pthread_create(&Error_reciver, NULL, Geter, (void *)&(numer));
for (int i = 1; i <= Thread_MAX; ++ i) {
id[i] = i;
int ret = pthread_create(&tids[i], NULL, While, (void *)&(id[i]));
if (ret) {
puts("\033[1m\033[35mSystem message:Multi threaded processing has crashed.\033[0m");
return 0;
}
}
pthread_exit(NULL);
}
Code (Version 2.0.1)
符合学长传参
// 2.0.1
#include <bits/stdc++.h>
#include <pthread.h>
#include <unistd.h>
using namespace std;
#define s(x) system(x)
string Needin, Needout, Rander, More;
string In(int x) {
string s = to_string(x) + ".in";
return s;
}
string Out(int x) {
return to_string(x) + ".out";
}
string Std(int x) {
return "std" + to_string(x) + ".out";
}
int Counts; int Thread_MAX = 10; double sec, TIME_LIMIT = 1000, SIZE_LIMIT = 128;
int all = 1000; int per[51]; bool Outer;
double times;
int id[51]; int Ender = 0;
pthread_t tids[51]; bool Exiter[51];
struct Messager {
int id, Thread_name, Testcase;
int caser;
double totimes, sec;
} p;
map <int, int> mp;
void Breaker(int x) {
if (!Exiter[x]) {
s(("cp " + In(x) + " WrongIn.in > 0.test").c_str());
s(("cp " + Out(x) + " WrongOut.out > 0.test").c_str());
s(("cp " + Std(x) + " WrongDatasCorrectOut.out > 0.test").c_str());
}
for (int i = 1; i <= Thread_MAX; ++ i) {
if (Exiter[i]) continue;
s(("rm -f " + In(i) + " > 0.test").c_str());
s(("rm -f " + Out(i) + " > 0.test").c_str());
s(("rm -f " + Std(i) + " > 0.test").c_str());
Exiter[i] = 1;
}
s("rm -f 0.test");
}
void* While(void *Point) {
int n = 1000;
int x = *((int *)Point);
for (int i = 1; i <= all; ++ i) {
if (Outer || Exiter[x]) pthread_exit(NULL);
Counts ++;
if (s(("./" + Rander + " > " + In(x) + " 2> 0.test").c_str())) {
p.id = -2, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
times -= clock();
int ret = s(("ulimit -s " + to_string((long long)SIZE_LIMIT) + " && timeout " + to_string(TIME_LIMIT) + "s ./" + Needin + "< " + In(x) + " > " + Out(x) + " 2> 0.test").c_str());
if (Outer || Exiter[x]) pthread_exit(NULL);
if (ret == 31744) {
p.id = 2, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
} else if (ret == 35584) {
p.id = 3, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
} else if (ret) {
p.id = 4, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
times += clock();
if (s(("./" + Needout + " < " + In(x) + " > " + Std(x) + " 2> 0.test").c_str())) {
p.id = -1, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
if (s(("diff " + Out(x) + " " + Std(x) + " -Z > 0.test").c_str())) {
p.id = 1, p.Thread_name = x, p.Testcase = Counts;
Outer = 1;
pthread_exit(NULL);
}
if (Counts % (Thread_MAX * 100) == 0) {
p.caser = Counts, p.sec = clock() * 1.0 / CLOCKS_PER_SEC;
p.totimes = times / Counts / CLOCKS_PER_SEC;
}
}
if (Outer) pthread_exit(NULL);
s(("rm -f " + In(x) + " > 0.test").c_str()), s(("rm -f " + Out(x) + " > 0.test").c_str()), s(("rm -f " + Std(x) + " > 0.test").c_str());
++ Ender; Exiter[x] = 1;
if (Ender == Thread_MAX) {
cout << "\033[1m\033[32mAll test case is Accepted, I will finish right now\033[0m\n";
exit(0);
}
pthread_exit(NULL);
}
void Breakls() {
for (int i = 1; i <= Thread_MAX; ++ i) {
if (Exiter[i]) continue;
s(("rm -f " + In(i) + "> 0.test").c_str()), s(("rm -f " + Out(i) + "> 0.test").c_str()), s(("rm -f " + Std(i) + "> 0.test").c_str());
}
s("rm -f 0.test");
}
void* Printer(void *Point) {
puts("\033[35m\033[1mSystem message:\033[0m\nListener is using.You can input “n” to ask the number of testcases, “c” for clean your terminal and “e” for kill all.\n\n --------------------------------");
string s;
while (Ender != Thread_MAX) {
if (Outer) pthread_exit(NULL);
bool now = 1;
for (int i = 1; i <= Thread_MAX; ++ i) now &= Exiter[i];
if (now) exit(0);
cin >> s;
if (s == "n") {
cout << "\033[1m\033[35mNow experience testcase:\033[0m" << Counts << '\n';
} else if (s == "e") {
cout << "\033[1m\033[35mOk I will kill myself right now.\n\033[0m";
Outer = 1;
usleep(500000); Breakls(); exit(0);
} else if (s == "c") {
s("clear");
}
}
pthread_exit(NULL);
}
bool O2er = 1, fsanitizer = 1;
inline void Solve(int argc, char **argv) {
if (argc <= 3) {
puts("\033[33m\033[1mCompile Error:\033[0mParameters num does not accord with format.");
exit(0);
}
Needin = argv[1], Needout = argv[2], Rander = argv[3];
int i = 4;
while (i < argc) {
if ((argv[i][1]) == 'l') {
all = atoi(argv[i + 1]);
i = i + 2;
} else if ((argv[i][1]) == 'p') {
Thread_MAX = atoi(argv[i + 1]);
i = i + 2;
} else if ((argv[i][1]) == 't') {
TIME_LIMIT = atoi(argv[i + 1]);
i = i + 2;
} else if ((argv[i][1]) == 'm') {
SIZE_LIMIT = atoi(argv[i + 1]);
i = i + 2;
} else if ((argv[i][1]) == 'f') {
fsanitizer = 0;
if (strlen(argv[i]) == 3) {
O2er = 0;
}
i = i + 1;
} else {
puts("\033[33m\033[1mCompile Error:\033[0mParameters num does not accord with format.");
exit(0);
}
}
if (TIME_LIMIT <= 0 || SIZE_LIMIT <= 0) {
puts("\033[33m\033[1mCompile Error:\033[0mParameters num does not accord with format.");
exit(0);
}
if (O2er && fsanitizer) s(("g++ -O2 -fsanitize=address,undefined " + Needin + ".cpp -o " + Needin).c_str());
else if (O2er) s(("g++ -O2 " + Needin + ".cpp -o " + Needin).c_str());
else s(("g++ " + Needin + ".cpp -o " + Needin).c_str());
s(("g++ " + Needout + ".cpp -o " + Needout).c_str());
s(("g++ " + Rander + ".cpp -o " + Rander).c_str());
s("clear");
puts("\033[1m\033[35mSystem message: \033[0mProgram compares successfully,we will run in just minutes.");
usleep(1000000);
s("clear");
for (int i = 1; i <= Thread_MAX; ++ i) {
s(("touch " + In(i)).c_str());
s(("touch " + Out(i)).c_str());
s(("touch " + Std(i)).c_str());
}
s("touch 0.test");
}
pthread_t printers, Error_reciver;
int numer = 51;
void *Geter(void *Point) {
while (!p.id) {
if (Outer) pthread_exit(NULL);
bool now = 1;
for (int i = 1; i <= Thread_MAX; ++ i) now &= Exiter[i];
if (now) exit(0);
if (p.caser) {
if (mp[p.caser]) {
p.sec = 0, p.caser = 0, p.totimes = 0;
continue;
}
mp[p.caser] = 1;
puts("--------------------------------");
puts("");
sec = clock() * 1.0 / CLOCKS_PER_SEC;
cout << "\033[1m\033[32mAccepted \033[0m" << p.caser << '\n' ;
cout << "\033[1m\033[35mNow expriences \033[0m" << "\033[1m\033[33m" << fixed << setprecision(3) << p.sec << " seconds.\033[0m" << '\n';
cout << "\033[1m\033[35mPer run-time: " << p.totimes << " s.\033[0m\n";
puts("");
p.sec = 0, p.caser = 0, p.totimes = 0;
}
}
usleep(500000);
if (p.id == -2) {
cout << "\033[1m\033[31mRandom Runing :: Break Informations : Rand.cpp break down.\n\033[0m";
} else if (p.id == -1) {
cout << "\033[1m\033[31mStd Wrong :: Break Informations : std.cpp break down.\n\033[0m";
} else if (p.id == 1) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[31mWrong on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 2) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[33mTime Limit Exceeded on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 3) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[33mMemory Limit Exceeded on Test " << p.Testcase << "\033[0m\n";
} else if (p.id == 4) {
cout << "\033[1m\033[35mYou Answer :: Break Informations In thread " << p.Thread_name << ":\033[0m " << "\033[31mRuntime Error on Test " << p.Testcase << "\033[0m\n";
}
Breaker(p.Thread_name);
exit(0);
pthread_exit(NULL);
}
signed main(int argc, char ** argv) {
Solve(argc, argv);
pthread_create(&printers, NULL, Printer, (void *)&(id[0]));
pthread_create(&Error_reciver, NULL, Geter, (void *)&(numer));
for (int i = 1; i <= Thread_MAX; ++ i) {
id[i] = i;
int ret = pthread_create(&tids[i], NULL, While, (void *)&(id[i]));
if (ret) {
puts("\033[1m\033[35mSystem message:Multi threaded processing has crashed.\033[0m");
return 0;
}
}
pthread_exit(NULL);
}