Skip to content

Commit 1ddbd6b

Browse files
committed
fix the comment
there is no standalone reader program anymore, the functionality was folded into source and the parent process dumps the file periodically.
1 parent 26063cf commit 1ddbd6b

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

file-locking/fcntl-locking.c

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,8 @@
1111
*
1212
* The file middle is denoted via '|' character.
1313
*
14-
* You have three ways of running it. Use the 'reader' command to print the
15-
* present state of the line while holding a lock.
16-
*
17-
* (1) The following will not lock at all:
18-
*
19-
* terminal1$ ./fcntl-locking xxx
20-
*
21-
* terminal2$ ./reader -l xxx
14+
* The parent process will periodically dump the file contents while adhering
15+
* to the locking protocol.
2216
*
2317
* You could also use the shell to print the file without locking on read:
2418
*
@@ -28,13 +22,17 @@
2822
*
2923
* _###./#./////_///.__#_____/_#___._#_|####_//..._#/.##._#.../..#####__#
3024
*
25+
* You have three ways of running it:
26+
*
27+
* (1) The following will not lock at all:
28+
*
29+
* terminal1$ ./fcntl-locking xxx
30+
*
3131
* (2) Will use locking for the 2nd half of the file with descriptor sharing
3232
* (that's the wrong solution, see "NOTE" below in the code):
3333
*
3434
* terminal1$ ./fcntl-locking -l xxx
3535
*
36-
* terminal2$ ./reader -l xxx
37-
*
3836
* You will see something "better" but obviously it does not work correctly.
3937
* The first half sees contention which is fine but the 2nd half should have
4038
* been composed from the same character since only one process is allowed to
@@ -47,8 +45,6 @@
4745
*
4846
* terminal1$ ./fcntl-locking -L xxx
4947
*
50-
* terminal2$ ./reader -l xxx
51-
*
5248
* You should see something like the following output. Note that the 1st half
5349
* is not much random because of the scheduler and a side effect of the implicit
5450
* ordering based on synchronization on the file middle position. The important

0 commit comments

Comments
 (0)