Re: thread unstarted
From: BMermuys (someone_at_someone.com)
Date: 03/20/04
- Next message: Tom: "Re: Obtaining Data Based Upon Multiple Selections From a ListBox"
- Previous message: genc ymeri: "Re: app.config"
- In reply to: Kovan Akrei: "thread unstarted"
- Next in thread: Kovan Akrei: "Re: thread unstarted"
- Reply: Kovan Akrei: "Re: thread unstarted"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 20 Mar 2004 04:03:29 +0100
Hi,
[inline]
"Kovan Akrei" <kovana@ifi.uio.no> wrote in message
news:e8FGFieDEHA.3280@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> When I check whether one my thread are running I use a bitmask like this:
>
> (myThread.ThreadState & (ThreadState.Stopped | ThreadState.Unstarted)) ==
0
> (got it from MSDN)
>
> How would I check whether a thread has been started or not without using
the
> property IsAlive? I'm trying to use a bit mask like this;
>
> if ((myThread.ThreadState | ThreadState.Unstarted) = = 8)
> myThread.Start();
What about :
if ( (myThread.ThreadState & ThreadState.Unstarted) ==
ThreadState.Unstarted)
myThread.Start();
For masking bits, use the &-operator.
>
> but I get an error message :
> Operator '= =' cannot be applied to operands of type
> 'System.Threading.ThreadState' and 'int'.
> I'm I doing something wrong? I can fix this by retyping av the bitmask to
> (int),
Don't know what you mean with 'av', but you can safely cast int to
threadstate or threadstate to int.
HTH,
greetings
> but I was wondering if there is another way to bitmask and get the
> right result?
>
> Regards from
> Kovan
>
>
- Next message: Tom: "Re: Obtaining Data Based Upon Multiple Selections From a ListBox"
- Previous message: genc ymeri: "Re: app.config"
- In reply to: Kovan Akrei: "thread unstarted"
- Next in thread: Kovan Akrei: "Re: thread unstarted"
- Reply: Kovan Akrei: "Re: thread unstarted"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|