Skip to content

Commit

Permalink
Merge pull request #19 from verhovsky/grammar
Browse files Browse the repository at this point in the history
Minor fixes
  • Loading branch information
IanLee1521 authored May 20, 2024
2 parents f608ff1 + db2d621 commit bc57a60
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion posix/example_code/hello_arg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ messages[1] = "French: Bonjour, le monde!";
messages[2] = "Spanish: Hola al mundo";
messages[3] = "Klingon: Nuq neH!";
messages[4] = "German: Guten Tag, Welt!";
messages[5] = "Russian: Zdravstvuyte, mir!";
messages[5] = "Russian: Zdravstvuy, mir!";
messages[6] = "Japan: Sekai e konnichiwa!";
messages[7] = "Latin: Orbis, te saluto!";

Expand Down
2 changes: 1 addition & 1 deletion posix/example_code/hello_arg2.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ messages[1] = "French: Bonjour, le monde!";
messages[2] = "Spanish: Hola al mundo";
messages[3] = "Klingon: Nuq neH!";
messages[4] = "German: Guten Tag, Welt!";
messages[5] = "Russian: Zdravstvytye, mir!";
messages[5] = "Russian: Zdravstvuy, mir!";
messages[6] = "Japan: Sekai e konnichiwa!";
messages[7] = "Latin: Orbis, te saluto!";

Expand Down
9 changes: 4 additions & 5 deletions posix/passing_args.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ All arguments must be passed by reference and cast to `(void *)`.

Question: Given their non-deterministic start-up and scheduling, how can you safely pass data to newly created threads?

<detail>
<details>
<summary>Answer (Click to view.)</summary>

*Make sure that all passed data is thread safe - that it can not be changed by other threads. The three examples that follow demonstrate dos and don'ts.*

</detail>
</details>

#### Example 1 - Thread Argument Passing

Expand Down Expand Up @@ -51,7 +50,7 @@ Thread 1: French: Bonjour, le monde!
Thread 2: Spanish: Hola al mundo
Thread 3: Klingon: Nuq neH!
Thread 4: German: Guten Tag, Welt!
Thread 5: Russian: Zdravstvytye, mir!
Thread 5: Russian: Zdravstvuy, mir!
Thread 6: Japan: Sekai e konnichiwa!
Thread 7: Latin: Orbis, te saluto!
```
Expand Down Expand Up @@ -110,7 +109,7 @@ Thread 1: French: Bonjour, le monde! Sum=1
Thread 2: Spanish: Hola al mundo Sum=3
Thread 3: Klingon: Nuq neH! Sum=6
Thread 4: German: Guten Tag, Welt! Sum=10
Thread 5: Russian: Zdravstvytye, mir! Sum=15
Thread 5: Russian: Zdravstvuy, mir! Sum=15
Thread 6: Japan: Sekai e konnichiwa! Sum=21
Thread 7: Latin: Orbis, te saluto! Sum=28
```
Expand Down
2 changes: 1 addition & 1 deletion posix/samples/hello_arg1.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ messages[1] = "French: Bonjour, le monde!";
messages[2] = "Spanish: Hola al mundo";
messages[3] = "Klingon: Nuq neH!";
messages[4] = "German: Guten Tag, Welt!";
messages[5] = "Russian: Zdravstvuyte, mir!";
messages[5] = "Russian: Zdravstvuy, mir!";
messages[6] = "Japan: Sekai e konnichiwa!";
messages[7] = "Latin: Orbis, te saluto!";

Expand Down
2 changes: 1 addition & 1 deletion posix/samples/hello_arg1.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Thread 1: French: Bonjour, le monde!
Thread 2: Spanish: Hola al mundo
Thread 3: Klingon: Nuq neH!
Thread 4: German: Guten Tag, Welt!
Thread 5: Russian: Zdravstvytye, mir!
Thread 5: Russian: Zdravstvuy, mir!
Thread 6: Japan: Sekai e konnichiwa!
Thread 7: Latin: Orbis, te saluto!
2 changes: 1 addition & 1 deletion posix/samples/hello_arg2.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ messages[1] = "French: Bonjour, le monde!";
messages[2] = "Spanish: Hola al mundo";
messages[3] = "Klingon: Nuq neH!";
messages[4] = "German: Guten Tag, Welt!";
messages[5] = "Russian: Zdravstvytye, mir!";
messages[5] = "Russian: Zdravstvuy, mir!";
messages[6] = "Japan: Sekai e konnichiwa!";
messages[7] = "Latin: Orbis, te saluto!";

Expand Down
2 changes: 1 addition & 1 deletion posix/samples/hello_arg2.out
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ Thread 1: French: Bonjour, le monde! Sum=1
Thread 2: Spanish: Hola al mundo Sum=3
Thread 3: Klingon: Nuq neH! Sum=6
Thread 4: German: Guten Tag, Welt! Sum=10
Thread 5: Russian: Zdravstvytye, mir! Sum=15
Thread 5: Russian: Zdravstvuy, mir! Sum=15
Thread 6: Japan: Sekai e konnichiwa! Sum=21
Thread 7: Latin: Orbis, te saluto! Sum=28
2 changes: 1 addition & 1 deletion posix/stack_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ author: Blaise Barney, Lawrence Livermore National Laboratory

[`pthread_attr_getstacksize(attr, stacksize)`](man/pthread_attr_getstacksize.txt)

[pthread_attr_setstacksize](man/pthread_attr_setstacksize.txt) (attr, addr, stacksize)
[`pthread_attr_setstacksize(attr, addr, stacksize)`](man/pthread_attr_setstacksize.txt)

[`pthread_attr_getstackaddr(attr, stackaddr)`](man/pthread_attr_getstackaddr.txt)

Expand Down
4 changes: 2 additions & 2 deletions posix/what_are_pthreads.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ In order to take full advantage of the capabilities provided by threads, a stand
The POSIX standard has continued to evolve and undergo revisions, including the Pthreads specification.

Some useful links:
* [standards.ieee.org/findstds/standard/1003.1-2008.html](http://standards.ieee.org/findstds/standard/1003.1-2008.html)
* www.opengroup.org/austin/papers/posix_faq.html
* [standards.ieee.org/ieee/1003.1/7101/](https://standards.ieee.org/ieee/1003.1/7101/)
* [www.opengroup.org/austin/papers/posix_faq.html)(http://www.opengroup.org/austin/papers/posix_faq.html)

Pthreads are defined as a set of C language programming types and procedure calls, implemented with a `pthread.h` header/include file and a thread library - though this library may be part of another library, such as `libc`, in some implementations.

0 comments on commit bc57a60

Please sign in to comment.