clean up namedpipes

This commit is contained in:
sabbene 2024-08-14 10:23:07 -07:00
parent 569137edd1
commit 87beeb64da
2 changed files with 12 additions and 12 deletions

View File

@ -28,10 +28,17 @@ char SCCSid[] = "@(#) @(#)context2.c:0.1 -- 8/06/24 11:11:11";
#include "timeit.c"
unsigned long iter;
char fifo1_name[] = "/tmp/test_fifo1XXXXXX";
char fifo2_name[] = "/tmp/test_fifo2XXXXXX";
void report()
{
fprintf(stderr, "COUNT|%lu|1|lps\n", iter);
// Clean up
unlink(fifo1_name);
unlink(fifo2_name);
exit(0);
}
@ -41,8 +48,6 @@ int main(int argc, char *argv[])
unsigned long check;
int fd1_read, fd1_write, fd2_read, fd2_write;
ssize_t ret;
char fifo1_name[] = "/tmp/test_fifo1XXXXXX";
char fifo2_name[] = "/tmp/test_fifo2XXXXXX";
if (argc != 2) {
fprintf(stderr, "Usage: context duration\n");
@ -151,8 +156,5 @@ int main(int argc, char *argv[])
}
}
// Clean up
unlink(fifo1_name);
unlink(fifo2_name);
}

View File

@ -28,10 +28,15 @@ char SCCSid[] = "@(#) @(#)named_pipe.c:0.1 -- 8/06/24 11:11:11";
#include "timeit.c"
unsigned long iter;
char fifo_name[] = "/tmp/test_fifoXXXXXX";
void report()
{
fprintf(stderr,"COUNT|%ld|1|lps\n", iter);
// Clean up
unlink(fifo_name);
exit(0);
}
@ -39,7 +44,6 @@ int main(int argc, char *argv[])
{
char buf[512];
int fd_read, fd_write, duration;
char fifo_name[] = "/tmp/test_fifoXXXXXX";
if (argc != 2) {
fprintf(stderr,"Usage: %s duration\n", argv[0]);
@ -88,10 +92,4 @@ int main(int argc, char *argv[])
}
iter++;
}
// Clean up
close(fd_read);
close(fd_write);
unlink(fifo_name);
}