FreeBSD Bugzilla – Attachment 234493 Details for
Bug 264441
Hang with Valgrind on single CPU systems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
standalone test case
pipe.c (text/plain), 884 bytes, created by
Mark Johnston
on 2022-06-06 17:49:54 UTC
(
hide
)
Description:
standalone test case
Filename:
MIME Type:
Creator:
Mark Johnston
Created:
2022-06-06 17:49:54 UTC
Size:
884 bytes
patch
obsolete
>#include <sys/types.h> >#include <sys/stat.h> > >#include <err.h> >#include <fcntl.h> >#include <pthread.h> >#include <stdlib.h> >#include <unistd.h> > >static void * >thr(void *arg) >{ > int fd; > char c; > > fd = *(int *)arg; > > for (;;) > read(fd, &c, 1); > > return (NULL); >} > >int >main(int argc, char **argv) >{ > static const char *fifopath = "./fifo"; > pthread_t *t; > int count, rfd, wfd; > > if (argc < 2) > errx(1, "usage"); > > (void)unlink(fifopath); > if (mkfifo(fifopath, 0600) != 0) > err(1, "mkfifo"); > > wfd = open(fifopath, O_RDWR | O_NONBLOCK); > if (wfd < 0) > err(1, "open"); > > rfd = open(fifopath, O_RDONLY); > if (rfd < 0) > err(1, "open"); > > count = atoi(argv[1]); > if (count <= 0) > errx(1, "usage"); > t = malloc(count * sizeof(pthread_t)); > for (int i = 0; i < count; i++) { > if (pthread_create(&t[i], NULL, thr, &rfd) != 0) > err(1, "pthread_create"); > } > > pthread_join(t[0], NULL); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 264441
: 234493