mmap not share

Dirk Freyer dfreyer@telecom.insa-lyon.fr
Mon Jun 25 11:53:00 GMT 2001


Under Linux this file works fine. Two tasks increments one counter :-)
With Windows 98 i have the problem that the two tasks increments two counters :-(

Why ???

I use cygwin 1.8.2

  int fd;
  void *ptr=NULL;
  int *counter;
 
  if ( (fd=open("tmem.sm",O_RDWR)) == -1) printf("File Error\n");
  else 
  if((ptr = mmap (NULL,sizeof(int), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1)
        printf("mmap Error\n");
  close(fd);
  printf("File=%i Ptr=%i\n",fd,ptr);
  counter=ptr;
  while (TRUE) {
      printf("counter=%i\n",(*counter)++);
	...
  }



--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list