Hello Ryan,
   I have a program with 3X threads for pulling data from queue and each
thread should make the pulled data shown on listview which tells the user
what the thread is handling.
I know the data should be marshalled into the main thread(GUI thread) so I
use the codes as follows
ISynchronizeInvoke synchronizer = listview .......
synchronizer.Invoke ...

This scenario works fine when the loading is not heavy(Two CPUs).
When the loading is heavy -- I means each thread is busy pulling data from
queue and there are lots of data in the queue.
A few hours later(Maybe a few days later), I will face a strange issue, one
or some of the busy threads hang.
This program should work 24/7. It turns out a big issue in semiconductor
FAB.
It never happens when we test it in single CPU.  But happen a lots(when
loading is heavy) in two CPUs environment.
I guess it's the MS marshal issue.
I make some test on this , I disable the marshal codes--this means no data
will be shown on listview.
There is no thread hang issue in this scenario.  That's why I guess marshal
is not a very safe way to do the function I need.
I swear I will never use the marshal anymore.
I have used google to search the problem. No report about this issue.
That is why I need to write a watchdog to monitor the threads. Once the
thread hang, abort it and recreate it.

I am sorry I use the wrong tool(process explorer) to check thread count,
because the logic thread count is increasing and I never saw it decreasing .

I saw the thread count dose decrease in taskman. This is what I want.
Sorry for this confusion.

Thanks for your help.

Best regards Peter




2006/9/6, Ryan Heath <[EMAIL PROTECTED]>:

Hi Peter,

First, you do know the ThreadPool?

Its QueueUserWorkItem can let you do some work without the need of
creating or deleting threads on your own.

Second, I cannot replay what you are seeing, when I create the threads
and start them I see the threadcount increasing in taskman, aborting
them or just let them finish, decreases the threadcount... (Though I
tested it with 2.0, i cant imaging something fundamental as threading
has changed from 1.1 to 2.0...)

Why is there a need to abort your threads? You say you are waiting for
an event, can you let them wait for an "abort" event, and when that
event occurs the thread just exits its runloop, which will destroy the
thread by it own.

HTH
// Ryan

On 9/5/06, peter lin <[EMAIL PROTECTED]> wrote:
> Dear all,
>   I create a thread and call its start  method, after some times pass, I
> make it wait for a event and block itself, then I call
> thread's abort method.  I found my thread count(viewed by process
explorer)
> is still the number before I call abort.
> I search it from lots of donet books. The only way I can do is calling
abort
> or call a flag and blah...
> My situation is like as follows.
>
> I have a multithread application using dotnet 1.1.One of the threads
hang I
> don't when it will cause this problem.
> So I guess I need to write a monitor thread to monitor all the threads.
Once
> thread hang, I can call the thread's abort function and recreate a
thread
> with the same properties
> to do its job. I found the thread count increasing . I just  don't  know
> why  the thread count  not decrease when the monitor call the thread's
abort
> function?
> Could someone tell me how to do this?
>
> Best regards Peter
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com


===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to