Skip to content

Commit eb62f64

Browse files
committed
Merge pull request #20988 from ciphergoth/task-to-thread
Purge references to Rust tasks from TRPL. Reviewed-by: steveklabnik
2 parents f3f6a27 + 8eba032 commit eb62f64

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

src/doc/trpl/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* [Iterators](iterators.md)
2727
* [Generics](generics.md)
2828
* [Traits](traits.md)
29-
* [Tasks](tasks.md)
29+
* [Threads](threads.md)
3030
* [Error Handling](error-handling.md)
3131
* [III: Advanced Topics](advanced.md)
3232
* [FFI](ffi.md)

src/doc/trpl/error-handling.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ errors that can occur.
181181
# Non-recoverable errors with `panic!`
182182

183183
In the case of an error that is unexpected and not recoverable, the `panic!`
184-
macro will induce a panic. This will crash the current task, and give an error:
184+
macro will induce a panic. This will crash the current thread, and give an error:
185185

186186
```{rust,ignore}
187187
panic!("boom");
@@ -190,7 +190,7 @@ panic!("boom");
190190
gives
191191

192192
```text
193-
task '<main>' panicked at 'boom', hello.rs:2
193+
thread '<main>' panicked at 'boom', hello.rs:2
194194
```
195195

196196
when you run it.

src/doc/trpl/ffi.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,12 @@ GitHub](https://github.com/thestinger/rust-snappy).
166166

167167
# Stack management
168168

169-
Rust tasks by default run on a *large stack*. This is actually implemented as a
169+
Rust threads by default run on a *large stack*. This is actually implemented as a
170170
reserving a large segment of the address space and then lazily mapping in pages
171171
as they are needed. When calling an external C function, the code is invoked on
172172
the same stack as the rust stack. This means that there is no extra
173173
stack-switching mechanism in place because it is assumed that the large stack
174-
for the rust task is plenty for the C function to have.
174+
for the rust thread is plenty for the C function to have.
175175

176176
A planned future improvement (not yet implemented at the time of this writing)
177177
is to have a guard page at the end of every rust stack. No rust function will
@@ -184,8 +184,8 @@ For normal external function usage, this all means that there shouldn't be any
184184
need for any extra effort on a user's perspective. The C stack naturally
185185
interleaves with the rust stack, and it's "large enough" for both to
186186
interoperate. If, however, it is determined that a larger stack is necessary,
187-
there are appropriate functions in the task spawning API to control the size of
188-
the stack of the task which is spawned.
187+
there are appropriate functions in the thread spawning API to control the size of
188+
the stack of the thread which is spawned.
189189

190190
# Destructors
191191

@@ -320,16 +320,15 @@ In the previously given examples the callbacks are invoked as a direct reaction
320320
to a function call to the external C library.
321321
The control over the current thread is switched from Rust to C to Rust for the
322322
execution of the callback, but in the end the callback is executed on the
323-
same thread (and Rust task) that lead called the function which triggered
324-
the callback.
323+
same thread that called the function which triggered the callback.
325324
326325
Things get more complicated when the external library spawns its own threads
327326
and invokes callbacks from there.
328327
In these cases access to Rust data structures inside the callbacks is
329328
especially unsafe and proper synchronization mechanisms must be used.
330329
Besides classical synchronization mechanisms like mutexes, one possibility in
331330
Rust is to use channels (in `std::comm`) to forward data from the C thread
332-
that invoked the callback into a Rust task.
331+
that invoked the callback into a Rust thread.
333332
334333
If an asynchronous callback targets a special object in the Rust address space
335334
it is also absolutely necessary that no more callbacks are performed by the

src/doc/trpl/testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ test it_works ... FAILED
9696
failures:
9797

9898
---- it_works stdout ----
99-
task 'it_works' panicked at 'assertion failed: false', /home/steve/tmp/adder/src/lib.rs:3
99+
thread 'it_works' panicked at 'assertion failed: false', /home/steve/tmp/adder/src/lib.rs:3
100100

101101

102102

@@ -105,7 +105,7 @@ failures:
105105

106106
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured
107107

108-
task '<main>' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
108+
thread '<main>' panicked at 'Some tests failed', /home/steve/src/rust/src/libtest/lib.rs:247
109109
```
110110

111111
Rust indicates that our test failed:
File renamed without changes.

src/doc/trpl/unsafe.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ code:
182182
- implement the `Drop` for resource clean-up via a destructor, and use
183183
RAII (Resource Acquisition Is Initialization). This reduces the need
184184
for any manual memory management by users, and automatically ensures
185-
that clean-up is always run, even when the task panics.
185+
that clean-up is always run, even when the thread panics.
186186
- ensure that any data stored behind a raw pointer is destroyed at the
187187
appropriate time.
188188

@@ -499,7 +499,7 @@ library, but without it you must define your own.
499499
The first of these three functions, `stack_exhausted`, is invoked whenever stack
500500
overflow is detected. This function has a number of restrictions about how it
501501
can be called and what it must do, but if the stack limit register is not being
502-
maintained then a task always has an "infinite stack" and this function
502+
maintained then a thread always has an "infinite stack" and this function
503503
shouldn't get triggered.
504504

505505
The second of these three functions, `eh_personality`, is used by the

0 commit comments

Comments
 (0)