Comprehensive Rust(繁体中文)
are accessible from any thread, they must be Sync. Interior mutability is possible through a Mutex, atomic or similar. Thread-local data can be created with the macro std::thread_local. 10.5 型別別名 型別別 std::time::Duration::try_from_secs_f32(secs) { dur } else { std::time::Duration::from_millis(500) }; std::thread::sleep(dur); println!("slept for {:?}", dur); } fn main() { sleep_for(-10.0); sleep_for(0.8); children. • 如要演示執行階段發生的恐慌情形,請新增 fn inc(&mut self),這可讓 self.value 遞增, 並在其子項呼叫相同的方法。在有參照迴圈的情況下,這會引發恐慌,其中的 thread 'main' 會 因 'already borrowed: BorrowMutError' 而恐慌。 22.4 練習:衛生統計資料 您正在實作健康監控系統,因此須追蹤使用者的健康統計資料。0 码力 | 358 页 | 1.41 MB | 10 月前3Julia 1.12.0 RC1
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 389 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3Julia 1.12.0 Beta4
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3Julia 1.12.0 Beta3
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2057 页 | 7.44 MB | 3 月前3julia 1.12.0 beta1
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2047 页 | 7.41 MB | 3 月前3julia 1.13.0 DEV
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 387 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multiple threads By default, Julia starts up with 2 threads of execution; 1 worker thread and 1 interactive thread. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads(:default)0 码力 | 2058 页 | 7.45 MB | 3 月前3Julia 1.11.6 Release Notes
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 25.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 2007 页 | 6.73 MB | 3 月前3julia 1.10.10
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 362 27.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363 27.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 24.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 1692 页 | 6.34 MB | 3 月前3Julia 1.11.4
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 25.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 2007 页 | 6.73 MB | 3 月前3Julia 1.11.5 Documentation
Accessing Data through a Pointer . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.16 Thread-safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385 28.17 More Multi-threading: Julia's multi-threading provides the ability to schedule Tasks simultaneously on more than one thread or CPU core, sharing memory. This is usually the easiest way to get parallelism on one's PC or on multi-threading features. 25.1 Starting Julia with multiple threads By default, Julia starts up with a single thread of execution. This can be verified by using the command Threads.nthreads(): julia> Threads.nthreads()0 码力 | 2007 页 | 6.73 MB | 3 月前3
共 23 条
- 1
- 2
- 3