From b592b48438d450f6327a70c9e6f60cd620302074 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Mon, 20 May 2024 02:54:50 -0600 Subject: [PATCH 1/4] Minor grammar fix --- posix/example_code/hello_arg1.c | 2 +- posix/example_code/hello_arg2.c | 2 +- posix/passing_args.md | 4 ++-- posix/samples/hello_arg1.c | 2 +- posix/samples/hello_arg1.out | 2 +- posix/samples/hello_arg2.c | 2 +- posix/samples/hello_arg2.out | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/posix/example_code/hello_arg1.c b/posix/example_code/hello_arg1.c index f29c456..67b8a79 100644 --- a/posix/example_code/hello_arg1.c +++ b/posix/example_code/hello_arg1.c @@ -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!"; diff --git a/posix/example_code/hello_arg2.c b/posix/example_code/hello_arg2.c index 9bf33cb..c32f602 100644 --- a/posix/example_code/hello_arg2.c +++ b/posix/example_code/hello_arg2.c @@ -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!"; diff --git a/posix/passing_args.md b/posix/passing_args.md index bf72335..b53e547 100644 --- a/posix/passing_args.md +++ b/posix/passing_args.md @@ -51,7 +51,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! ``` @@ -110,7 +110,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 ``` diff --git a/posix/samples/hello_arg1.c b/posix/samples/hello_arg1.c index 31d3db7..2bd224d 100644 --- a/posix/samples/hello_arg1.c +++ b/posix/samples/hello_arg1.c @@ -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!"; diff --git a/posix/samples/hello_arg1.out b/posix/samples/hello_arg1.out index c668c9e..624e110 100644 --- a/posix/samples/hello_arg1.out +++ b/posix/samples/hello_arg1.out @@ -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! diff --git a/posix/samples/hello_arg2.c b/posix/samples/hello_arg2.c index d9a0a90..9ffdf51 100644 --- a/posix/samples/hello_arg2.c +++ b/posix/samples/hello_arg2.c @@ -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!"; diff --git a/posix/samples/hello_arg2.out b/posix/samples/hello_arg2.out index b4d2322..b756c4f 100644 --- a/posix/samples/hello_arg2.out +++ b/posix/samples/hello_arg2.out @@ -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 From a90f9d3c60e3a2beaa98f463e5fe7f8fa328e035 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Mon, 20 May 2024 03:11:00 -0600 Subject: [PATCH 2/4] Another typo --- posix/stack_management.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/posix/stack_management.md b/posix/stack_management.md index e7f52ea..d4f642c 100644 --- a/posix/stack_management.md +++ b/posix/stack_management.md @@ -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) From 681a5ea1faedbd2267c19eeed0f502134a0eed09 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Mon, 20 May 2024 03:28:43 -0600 Subject: [PATCH 3/4] Fix links --- posix/what_are_pthreads.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/posix/what_are_pthreads.md b/posix/what_are_pthreads.md index b475537..cd43650 100644 --- a/posix/what_are_pthreads.md +++ b/posix/what_are_pthreads.md @@ -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. From db2d6212dfd76b9e54c983375dcdddc344c17a82 Mon Sep 17 00:00:00 2001 From: Boris Verkhovskiy Date: Mon, 20 May 2024 03:28:49 -0600 Subject: [PATCH 4/4] Fix clickable answer --- posix/passing_args.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/posix/passing_args.md b/posix/passing_args.md index b53e547..006a7b1 100644 --- a/posix/passing_args.md +++ b/posix/passing_args.md @@ -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? - +
Answer (Click to view.) *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.* - - +
#### Example 1 - Thread Argument Passing