create BackgroundWorker from BackgroundWorked is possible?

C

Coaster

I want to create a "thread manager" class to manage an array of
backgroundworkers. I'd like this thread manager class to live in a class
library and I wasn't sure if it was possible to make the thread manager a
subclass of the backgroundworker so that I could start it up and still do
other things on the client. Essentially a thread that spins off new threads.

Am I going to hit any limitations here?

thank you
 
M

Marc Gravell

I'm not quite sure why you would want this class be subclass the
ThreadManager - and I'm alson not quite sure whether you can't simply
use ThreadPool here - can you explain the scenario a bit more?

Marc
 
I

Ignacio Machin ( .NET/ C# MVP )

I want to create a "thread manager" class to manage an array of
backgroundworkers. I'd like this thread manager class to live in a class
library and I wasn't sure if it was possible to make the thread manager a
subclass of the backgroundworker so that I could start it up and still do
other things on the client. Essentially a thread that spins off new threads.

Am I going to hit any limitations here?

thank you

Ho,

Yes, you can derive from it. Why though is a different question.
Are you going to do some sync. among the threads?

Other than that I see no explanation why
 
C

Coaster

message
I want to create a "thread manager" class to manage an array of
backgroundworkers. I'd like this thread manager class to live in a class
library and I wasn't sure if it was possible to make the thread manager a
subclass of the backgroundworker so that I could start it up and still do
other things on the client. Essentially a thread that spins off new
threads.

Am I going to hit any limitations here?

thank you

Ho,

Yes, you can derive from it. Why though is a different question.
Are you going to do some sync. among the threads?

Other than that I see no explanation why



Let me clear this up a bit. Let's say I have class ThreadManager and in
ThreadManager I want to spin off several background threads to perform
various tasks. What the tasks do, the order to which they run and
dependencies upon each other is irrelevent for this discussion but all of
that is managed from within the ThreadManager. In fact TaskManager might be
a better name for this class.

In any case, I have this class and I want to be able to instanciate this
class on its own thread so that whatever application (windows service,
console app or windows app) runs it, it will run independent on the clients
main thread, it'll run asynchronously. So my main question was if I created
a backgroundworker to execute the threadmanager (either thru subclassing or
not) will it be able to create other backgroundworkers to execute the tasks?
I rememeber something from my c++ days about worker threads couldn't create
other worker threads or gui threads, I forgoet but I was looking to see if
such a limitation exists in this environment.

Thanks for the help, I haven't really read up on thread pooling but plan to
do so , so maybe that will work for me. It probably will in the
threadmanagers managing of task threads.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top