wangzhengquan
2020-07-20 af100db4697a85522893ebbffbf2de2741988265
test/test_lostdata.c
@@ -2,11 +2,9 @@
extern char **environ; 
using namespace std;
SQueue<struct Item> *queue;
// 销毁共享内存和信号
void sigint_handler(int sig) {
   destroy();
   // mm_destroy();
   exit(0);
}
@@ -14,7 +12,7 @@
   signal(SIGINT,  sigint_handler);
   remove("p.txt");
   remove("c.txt");
   int status, i = 0, processors = 5, scale = 100000;
   int status, i = 0, processors = 4, scale = 100000;
   pid_t productors[processors], consumers[processors];
   pid_t pid;
@@ -34,7 +32,8 @@
         int start = i * scale, end = i * scale + scale;
         char cmd[1000];
         // char  *argv[] = {"productor", start, end, NULL };
         const char *cmdfmt = "./productor %d %d >> p.txt";
         // const char *cmdfmt = "./single_productor %d %d >> p.txt";
         const char *cmdfmt = "./single_productor %d %d >> p.txt";
         sprintf(cmd, cmdfmt, start, end);
         if (execl("/bin/bash", "bash", "-c", cmd, 0) < 0)
          {
@@ -49,7 +48,8 @@
             
         // char cmd[1000];
         // char  *argv[] = {"productor", start, end, NULL };
          const char *cmd = "./consumer  >> c.txt";
          // const char *cmd = "./single_consumer  >> c.txt";
          const char *cmd = "./single_consumer >> c.txt";
         if (execl("/bin/bash", "bash", "-c", cmd, 0) < 0)
          {
              err_exit(errno, "consumers execve");
@@ -68,7 +68,7 @@
      perror("waitpid error");
    destroy();
   //mm_destroy();