MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / reader

Function reader

test/shared-memory2.c:92–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92void
93reader(int fd)
94{
95 int *sharedMemory;
96 int i;
97
98 sharedMemory = mmap(0, sizeof(int), PROT_READ, MAP_SHARED, fd, 0);
99 if (sharedMemory == MAP_FAILED) {
100 perror("mmap");
101 exit(1);
102 }
103 for (i = -1;;) {
104 if (*sharedMemory > i) {
105 i = *sharedMemory;
106 printf("%d ", i);
107 fflush(stdout);
108 }
109 sleep(1);
110 }
111}
112
113void
114writer(int fd)

Callers 1

mainFunction · 0.70

Calls 2

mmapFunction · 0.70
sleepFunction · 0.50

Tested by

no test coverage detected