|
896 | 896 | ## Remarks
|
897 | 897 | Use this method to create a memory-mapped file that is not persisted (that is, not associated with a file on disk), which you can use to share data between processes.
|
898 | 898 |
|
899 |
| -
|
900 |
| -
|
901 | 899 | ## Examples
|
902 | 900 | The following example is composed of three separate processes (console applications) that write `Boolean` values to a memory-mapped file. The following sequence of actions occur:
|
903 | 901 |
|
904 |
| -1. Process A creates the memory-mapped file and writes a value to it. |
905 |
| -
|
906 |
| -2. Process B opens the memory-mapped file and writes a value to it. |
907 |
| -
|
908 |
| -3. Process C opens the memory-mapped file and writes a value to it. |
909 |
| -
|
910 |
| -4. Process A reads and displays the values from the memory-mapped file. |
911 |
| -
|
912 |
| -5. After Process A is finished with the memory-mapped file, the file is immediately reclaimed by garbage collection. |
| 902 | +1. Process A creates the memory-mapped file and writes a value to it. |
| 903 | +2. Process B opens the memory-mapped file and writes a value to it. |
| 904 | +3. Process C opens the memory-mapped file and writes a value to it. |
| 905 | +4. Process A reads and displays the values from the memory-mapped file. |
| 906 | +5. After Process A is finished with the memory-mapped file, the file is immediately reclaimed by garbage collection. |
913 | 907 |
|
914 | 908 | To run this example, do the following:
|
915 | 909 |
|
916 |
| -1. Compile the applications and open three Command windows. |
917 |
| -
|
918 |
| -2. In the first Command window, run Process A. |
919 |
| -
|
920 |
| -3. In the second Command window, run Process B. |
921 |
| -
|
922 |
| -4. Return to Process A and press ENTER. |
923 |
| -
|
924 |
| -5. In the third Command window, run Process C. |
925 |
| -
|
926 |
| -6. Return to Process A and press ENTER. |
| 910 | +1. Compile the applications and open three Command windows. |
| 911 | +2. In the first Command window, run Process A. |
| 912 | +3. In the second Command window, run Process B. |
| 913 | +4. Return to Process A and press ENTER. |
| 914 | +5. In the third Command window, run Process C. |
| 915 | +6. Return to Process A and press ENTER. |
927 | 916 |
|
928 | 917 | The output of Process A is as follows:
|
929 | 918 |
|
930 |
| -``` |
| 919 | +```txt |
931 | 920 | Start Process B and press ENTER to continue.
|
932 | 921 | Start Process C and press ENTER to continue.
|
933 | 922 | Process A says: True
|
|
0 commit comments