@@ -166,12 +166,12 @@ GitHub](https://github.com/thestinger/rust-snappy).
166
166
167
167
# Stack management
168
168
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
170
170
reserving a large segment of the address space and then lazily mapping in pages
171
171
as they are needed. When calling an external C function, the code is invoked on
172
172
the same stack as the rust stack. This means that there is no extra
173
173
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.
175
175
176
176
A planned future improvement (not yet implemented at the time of this writing)
177
177
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
184
184
need for any extra effort on a user's perspective. The C stack naturally
185
185
interleaves with the rust stack, and it's "large enough" for both to
186
186
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.
189
189
190
190
# Destructors
191
191
@@ -320,16 +320,15 @@ In the previously given examples the callbacks are invoked as a direct reaction
320
320
to a function call to the external C library.
321
321
The control over the current thread is switched from Rust to C to Rust for the
322
322
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.
325
324
326
325
Things get more complicated when the external library spawns its own threads
327
326
and invokes callbacks from there.
328
327
In these cases access to Rust data structures inside the callbacks is
329
328
especially unsafe and proper synchronization mechanisms must be used.
330
329
Besides classical synchronization mechanisms like mutexes, one possibility in
331
330
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 .
333
332
334
333
If an asynchronous callback targets a special object in the Rust address space
335
334
it is also absolutely necessary that no more callbacks are performed by the
0 commit comments