Re: passing parameter to thread ??
From: Nicholas Paldino [.NET/C# MVP] (mvp_at_spam.guard.caspershouse.com)
Date: 09/27/04
- Next message: Cider123: "Re: AppDomain / Assembly Bug or what's wrong?"
- Previous message: Girish Bharadwaj: "Re: IEnumerator interface"
- In reply to: Richard Blewett [DevelopMentor]: "Re: passing parameter to thread ??"
- Next in thread: Jon Skeet [C# MVP]: "Re: passing parameter to thread ??"
- Reply: Jon Skeet [C# MVP]: "Re: passing parameter to thread ??"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 27 Sep 2004 09:14:32 -0400
Also, in .NET 2.0, the Thread class has an overloads for the constructor
and the Start methods to allow for the ParameterizedThreadStart delegate,
which allows a parameter to be passed to the thread routine.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@spam.guard.caspershouse.com
"Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message
news:O8NaKfIpEHA.3896@TK2MSFTNGP15.phx.gbl...
> Diving in before Jon does ;-)
>
> http://www.yoda.arachsys.com/csharp/threadstart.html
>
> Regards
>
> Richard Blewett - DevelopMentor
> http://staff.develop.com/richardb/weblog
>
>
> nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<#Wo6xVIpEHA.1644@tk2msftngp13.phx.gbl>
>
> Hi,
>
> Is there a way to pass a parameter to a thread ?
>
> Creating a thread is done using a ThreadStart-delegate object
>
> example :
> Thread thread1 = new Thread(new ThreadStart(MyFunction))
>
> Unfortunately, it doesn't allow me to pass arguments to MyFunction since
> the definition of the ThreadStart is :
> public delegate void ThreadStart();
>
> Is there a way, anyhow, to pass a parameter to a thread ?
> Using some other mechanism ?
>
> thnx
> Christian
>
> **********************************************************************
> Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
> Comprehensive, categorised, searchable collection of links to ASP &
> ASP.NET resources...
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.768 / Virus Database: 515 - Release Date: 22/09/2004
>
>
>
> [microsoft.public.dotnet.languages.csharp]
- Next message: Cider123: "Re: AppDomain / Assembly Bug or what's wrong?"
- Previous message: Girish Bharadwaj: "Re: IEnumerator interface"
- In reply to: Richard Blewett [DevelopMentor]: "Re: passing parameter to thread ??"
- Next in thread: Jon Skeet [C# MVP]: "Re: passing parameter to thread ??"
- Reply: Jon Skeet [C# MVP]: "Re: passing parameter to thread ??"
- Messages sorted by: [ date ] [ thread ]