Skip to content

thread::scoped::JoinGuard 예제: scoped thread라 해서 &mut를 여러 번 취해도 되는 건가? #4

@nomicon-kr

Description

@nomicon-kr

leaking.mdthread::scoped::JoinGuard 예제에서 든 의문. 각 스레드에서

for x in &mut data {
    let guard = thread::scoped(move || { *x *= 2; });
    guards.push(guard);
}

가변 레퍼런스를 (겹치지 않는 부분이지만) 여러 번 취하는 것 같은데... 가능한 것인가?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions