mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-29 05:37:37 +02:00
ko: refresh translation for concurrency (#932)
* ko: refresh translation for concurrency Part of #925. * ko: move translation back to where it belongs This is likely outdated, but moving it here helps avoid conflicts. The outdated paragraph can be cleaned up with `msgmerge` at a later point.
This commit is contained in:
parent
d8ffa270aa
commit
ab5988180b
263
po/ko.po
263
po/ko.po
@ -11473,6 +11473,24 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::thread;\n"
|
||||
"use std::time::Duration;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" thread::spawn(|| {\n"
|
||||
" for i in 1..10 {\n"
|
||||
" println!(\"Count in thread: {i}!\");\n"
|
||||
" thread::sleep(Duration::from_millis(5));\n"
|
||||
" }\n"
|
||||
" });\n"
|
||||
"\n"
|
||||
" for i in 1..5 {\n"
|
||||
" println!(\"Main thread: {i}\");\n"
|
||||
" thread::sleep(Duration::from_millis(5));\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/threads.md:24
|
||||
msgid ""
|
||||
@ -11527,6 +11545,17 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable,compile_fail\n"
|
||||
"use std::thread;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let s = String::from(\"Hello\");\n"
|
||||
"\n"
|
||||
" thread::spawn(|| {\n"
|
||||
" println!(\"Length: {}\", s.len());\n"
|
||||
" });\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/scoped-threads.md:17
|
||||
msgid "However, you can use a [scoped thread][1] for this:"
|
||||
@ -11548,6 +11577,19 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::thread;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let s = String::from(\"Hello\");\n"
|
||||
"\n"
|
||||
" thread::scope(|scope| {\n"
|
||||
" scope.spawn(|| {\n"
|
||||
" println!(\"Length: {}\", s.len());\n"
|
||||
" });\n"
|
||||
" });\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/scoped-threads.md:37
|
||||
msgid ""
|
||||
@ -11590,6 +11632,24 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::mpsc;\n"
|
||||
"use std::thread;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let (tx, rx) = mpsc::channel();\n"
|
||||
"\n"
|
||||
" tx.send(10).unwrap();\n"
|
||||
" tx.send(20).unwrap();\n"
|
||||
"\n"
|
||||
" println!(\"Received: {:?}\", rx.recv());\n"
|
||||
" println!(\"Received: {:?}\", rx.recv());\n"
|
||||
"\n"
|
||||
" let tx2 = tx.clone();\n"
|
||||
" tx2.send(30).unwrap();\n"
|
||||
" println!(\"Received: {:?}\", rx.recv());\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/channels.md:27
|
||||
msgid ""
|
||||
@ -11636,6 +11696,56 @@ msgid ""
|
||||
"```"
|
||||
msgstr ""
|
||||
|
||||
#: src/concurrency/channels/unbounded.md:5
|
||||
msgid ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::mpsc;\n"
|
||||
"use std::thread;\n"
|
||||
"use std::time::Duration;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let (tx, rx) = mpsc::channel();\n"
|
||||
"\n"
|
||||
" thread::spawn(move || {\n"
|
||||
" let thread_id = thread::current().id();\n"
|
||||
" for i in 1..10 {\n"
|
||||
" tx.send(format!(\"Message {i}\")).unwrap();\n"
|
||||
" println!(\"{thread_id:?}: sent Message {i}\");\n"
|
||||
" }\n"
|
||||
" println!(\"{thread_id:?}: done\");\n"
|
||||
" });\n"
|
||||
" thread::sleep(Duration::from_millis(100));\n"
|
||||
"\n"
|
||||
" for msg in rx.iter() {\n"
|
||||
" println!(\"Main: got {msg}\");\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::mpsc;\n"
|
||||
"use std::thread;\n"
|
||||
"use std::time::Duration;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let (tx, rx) = mpsc::channel();\n"
|
||||
"\n"
|
||||
" thread::spawn(move || {\n"
|
||||
" let thread_id = thread::current().id();\n"
|
||||
" for i in 1..10 {\n"
|
||||
" tx.send(format!(\"Message {i}\")).unwrap();\n"
|
||||
" println!(\"{thread_id:?}: sent Message {i}\");\n"
|
||||
" }\n"
|
||||
" println!(\"{thread_id:?}: done\");\n"
|
||||
" });\n"
|
||||
" thread::sleep(Duration::from_millis(100));\n"
|
||||
"\n"
|
||||
" for msg in rx.iter() {\n"
|
||||
" println!(\"Main: got {msg}\");\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/channels/bounded.md:1
|
||||
msgid "# Bounded Channels"
|
||||
msgstr "# 경계가 있는 채널(Bounded Channels)"
|
||||
@ -11670,6 +11780,29 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::mpsc;\n"
|
||||
"use std::thread;\n"
|
||||
"use std::time::Duration;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let (tx, rx) = mpsc::sync_channel(3);\n"
|
||||
"\n"
|
||||
" thread::spawn(move || {\n"
|
||||
" let thread_id = thread::current().id();\n"
|
||||
" for i in 1..10 {\n"
|
||||
" tx.send(format!(\"Message {i}\")).unwrap();\n"
|
||||
" println!(\"{thread_id:?}: sent Message {i}\");\n"
|
||||
" }\n"
|
||||
" println!(\"{thread_id:?}: done\");\n"
|
||||
" });\n"
|
||||
" thread::sleep(Duration::from_millis(100));\n"
|
||||
"\n"
|
||||
" for msg in rx.iter() {\n"
|
||||
" println!(\"Main: got {msg}\");\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/shared_state.md:1
|
||||
msgid "# Shared State"
|
||||
@ -11766,6 +11899,21 @@ msgid ""
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::Mutex;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let v = Mutex::new(vec![10, 20, 30]);\n"
|
||||
" println!(\"v: {:?}\", v.lock().unwrap());\n"
|
||||
"\n"
|
||||
" {\n"
|
||||
" let mut guard = v.lock().unwrap();\n"
|
||||
" guard.push(40);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" println!(\"v: {:?}\", v.lock().unwrap());\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/shared_state/mutex.md:22
|
||||
msgid ""
|
||||
@ -11820,7 +11968,7 @@ msgstr ""
|
||||
|
||||
#: src/concurrency/shared_state/example.md:23
|
||||
msgid "Possible solution:"
|
||||
msgstr ""
|
||||
msgstr "가능한 해결책:"
|
||||
|
||||
#: src/concurrency/shared_state/example.md:25
|
||||
msgid ""
|
||||
@ -11947,7 +12095,7 @@ msgstr "# 예제"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:3
|
||||
msgid "## `Send + Sync`"
|
||||
msgstr ""
|
||||
msgstr "## `Send + Sync`"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:5
|
||||
msgid "Most types you come across are `Send + Sync`:"
|
||||
@ -11977,7 +12125,7 @@ msgstr "제네릭 타입은 일반적으로 타입 파라메터가 `Send + Sync`
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:17
|
||||
msgid "## `Send + !Sync`"
|
||||
msgstr ""
|
||||
msgstr "## `Send + !Sync`"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:19
|
||||
msgid ""
|
||||
@ -11992,10 +12140,14 @@ msgid ""
|
||||
"* `Cell<T>`\n"
|
||||
"* `RefCell<T>`"
|
||||
msgstr ""
|
||||
"* `mpsc::Sender<T>`\n"
|
||||
"* `mpsc::Receiver<T>`\n"
|
||||
"* `Cell<T>`\n"
|
||||
"* `RefCell<T>`"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:27
|
||||
msgid "## `!Send + Sync`"
|
||||
msgstr ""
|
||||
msgstr "## `!Send + Sync`"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:29
|
||||
msgid "These types are thread-safe, but they cannot be moved to another thread:"
|
||||
@ -12009,7 +12161,7 @@ msgstr "* `MutexGuard<T>`: 내부적으로, 운영체제가 제공하는 primiti
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:34
|
||||
msgid "## `!Send + !Sync`"
|
||||
msgstr ""
|
||||
msgstr "## `!Send + !Sync`"
|
||||
|
||||
#: src/concurrency/send-sync/examples.md:36
|
||||
msgid "These types are not thread-safe and cannot be moved to other threads:"
|
||||
@ -12025,6 +12177,107 @@ msgstr ""
|
||||
"* `Rc<T>`: `Rc<T>` 는 아토믹하지 않은 방식으로 참조 카운트를 조작하는 `RcBox<T>`를 참조합니다.\n"
|
||||
"* `*const T`, `*mut T`: 러스트는 포인터가 스레드 안전하지 않다고 가정합니다."
|
||||
|
||||
#: src/concurrency/send-sync/send.md:13
|
||||
msgid ""
|
||||
"As an example, a connection to the SQLite library must only be accessed from "
|
||||
"a\n"
|
||||
"single thread."
|
||||
msgstr ""
|
||||
"예를 들어 SQLite 라이브러리 연결은 단일 스레드에서만\n"
|
||||
"액세스해야 합니다."
|
||||
|
||||
#: src/concurrency/shared_state/arc.md:5
|
||||
msgid ""
|
||||
"```rust,editable\n"
|
||||
"use std::thread;\n"
|
||||
"use std::sync::Arc;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let v = Arc::new(vec![10, 20, 30]);\n"
|
||||
" let mut handles = Vec::new();\n"
|
||||
" for _ in 1..5 {\n"
|
||||
" let v = Arc::clone(&v);\n"
|
||||
" handles.push(thread::spawn(move || {\n"
|
||||
" let thread_id = thread::current().id();\n"
|
||||
" println!(\"{thread_id:?}: {v:?}\");\n"
|
||||
" }));\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" handles.into_iter().for_each(|h| h.join().unwrap());\n"
|
||||
" println!(\"v: {v:?}\");\n"
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::thread;\n"
|
||||
"use std::sync::Arc;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let v = Arc::new(vec![10, 20, 30]);\n"
|
||||
" let mut handles = Vec::new();\n"
|
||||
" for _ in 1..5 {\n"
|
||||
" let v = Arc::clone(&v);\n"
|
||||
" handles.push(thread::spawn(move || {\n"
|
||||
" let thread_id = thread::current().id();\n"
|
||||
" println!(\"{thread_id:?}: {v:?}\");\n"
|
||||
" }));\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" handles.into_iter().for_each(|h| h.join().unwrap());\n"
|
||||
" println!(\"v: {v:?}\");\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/concurrency/shared_state/example.md:25
|
||||
msgid ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::{Arc, Mutex};\n"
|
||||
"use std::thread;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n"
|
||||
"\n"
|
||||
" let v2 = Arc::clone(&v);\n"
|
||||
" let handle = thread::spawn(move || {\n"
|
||||
" let mut v2 = v2.lock().unwrap();\n"
|
||||
" v2.push(10);\n"
|
||||
" });\n"
|
||||
"\n"
|
||||
" {\n"
|
||||
" let mut v = v.lock().unwrap();\n"
|
||||
" v.push(1000);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" handle.join().unwrap();\n"
|
||||
"\n"
|
||||
" println!(\"v: {v:?}\");\n"
|
||||
"}\n"
|
||||
"```"
|
||||
msgstr ""
|
||||
"```rust,editable\n"
|
||||
"use std::sync::{Arc, Mutex};\n"
|
||||
"use std::thread;\n"
|
||||
"\n"
|
||||
"fn main() {\n"
|
||||
" let v = Arc::new(Mutex::new(vec![10, 20, 30]));\n"
|
||||
"\n"
|
||||
" let v2 = Arc::clone(&v);\n"
|
||||
" let handle = thread::spawn(move || {\n"
|
||||
" let mut v2 = v2.lock().unwrap();\n"
|
||||
" v2.push(10);\n"
|
||||
" });\n"
|
||||
"\n"
|
||||
" {\n"
|
||||
" let mut v = v.lock().unwrap();\n"
|
||||
" v.push(1000);\n"
|
||||
" }\n"
|
||||
"\n"
|
||||
" handle.join().unwrap();\n"
|
||||
"\n"
|
||||
" println!(\"v: {v:?}\");\n"
|
||||
"}\n"
|
||||
"```"
|
||||
|
||||
#: src/exercises/day-4/morning.md:1 src/exercises/day-4/android.md:1
|
||||
msgid "# Exercises"
|
||||
msgstr "# 연습문제"
|
||||
|
Loading…
x
Reference in New Issue
Block a user