This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

mmap not share


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]