Re: Local var passed to thread. May it get reclaimed by GC???
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 08/31/04
- Next message: BCDesign: "Walking the file system"
- Previous message: jackchen: "Why BinarySearch return a wrong value ? ( -4)"
- In reply to: Bob Rock: "Local var passed to thread. May it get reclaimed by GC???"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 31 Aug 2004 21:42:01 +0100
Bob Rock <pelledoca@letterboxes-dot-org.no-spam.invalid> wrote:
> my questiong is, I believe, very simple.
> I have a method and inside it I'm passing a local variable (of a
> reference type) to a newly created thread (created inside the method
> itself). Since the method may end while the thread may not have yet
> completed its work, I was wondering if anything must be done to avoid
> the garbage collector reclaiming the variable before the thread has
> completed.
If the other thread has a reference to the object, you needn't worry
about the garbage collector reclaiming it early.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: BCDesign: "Walking the file system"
- Previous message: jackchen: "Why BinarySearch return a wrong value ? ( -4)"
- In reply to: Bob Rock: "Local var passed to thread. May it get reclaimed by GC???"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|