Hi, Attach is the simple test case I use to reproduce the valgrind warning and random failures.
Compile the test case in Cygwin with below command line: $ gcc -g -O0 flock.c -o flock.exe Thanks!
/*********************************************************************** * This is a STC that causes the following error on my test machine: * NtCreateEvent(lock): 0xC0000035 * * It tries to use flock() for file locking. It creates a temporary * file, the uses fork to spawn a number of children. Each child opens * the file, then repeatedly uses flock to lock and unlock it. * * This test was extracted from the APR test suite. * * Compile: gcc -Wall -o stc-flock-fork stc-flock-fork.c ***********************************************************************/ #include <sys/types.h> #include <sys/file.h> #include <sys/wait.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #define MAX_ITER 2000 #define CHILDREN 6 /* A temporary file used for flock. */ char tmpfilename[] = "/tmp/flocktstXXXXXX"; int main(int argc, const char * const * argv, const char * const *env) { int fd; /* Create the temporary file. */ fd = mkstemp(tmpfilename); if (fd < 0) { perror("open failed"); exit(1); } close(fd); int fd2 = open(tmpfilename, O_RDONLY); int rc; int i; rc = flock(fd2, LOCK_EX); return 0; }
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple