Thread Pool Class

Thread Pool Class

Post by todd la » Sat, 08 Mar 1997 04:00:00



I'm trying to write a Thread Pool class in C++ using pthreads on a sun machine.
Basically, the classes construction takes how many worker threads need to be
created, and creates the threads and the queue that manages the list of
of functions needing to be executed.  The class also has an add method which
takes a function pointer and function argument as its arguments.  It takes
these parameters and populates the queue with this information.

I've written the above, and it all seems to work as an isolated single file
program.  The problem I'm encountering is when I try to merge it into the
full blown project.  I've put in logging, and it seems that the classes
deconstructor is getting fired as soon as the instance is created.  This
forces the threads to shutdown.  What's really weird is that subsequent calls
to add seem to successfully fire, but the actual function pointer and argument
are not utilized; that is, they are never executed.

I'm using Sun's 4.1 C++ Compiler with the -mt flag.  I'm also linking with
-pthread.

Any ideas what might be wrong?  I ran home tonight, and tried the same code
on my Linux machine.  I've gotten the same exact results here too, so I'm
pretty sure it's something I'm doing.

Any help will be greatly appreciated.

 
 
 

1. problem running Java Applets on linux - threads: cannot find class java/lang/Thread ????

I have a problem running Java Applets.
I'm running a SuSE7.2 based machine.

When accessing a page that has a simple "Hello World!" Java Applet
on it, the Konqueror window stays "Loading Applet".
When accessing the same page from another machne, it runs fine.

So... conclusion: the Applet is fine?

So now what is wrong?
I already checked some things.

In the browser, Settings->KonquerorBrowser->Java
I Do have: "Enable Java Globally" enabled,
I have Path to java executable to 'java'
And have not specified any Domain specific stuff

The 'java' points to:


/usr/lib/java/bin/java

This is a version 1.1.8:

java version "1.1.8"

So, IMHO, it seems that I DO have a working java. Don't I?

I also tried a different java, under: :/usr/lib/jdk1.3/jre/bin/java

java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0)
Java HotSpot(TM) Client VM (build 1.3.0, mixed mode)

But with similar results.

I tried starting Konqueror from the commandline, to see if it
complains.... Well it does, a little.


http://jvdploe.speed.planet.nl/~jvdploe/webcam/johncamjava.cgi
kdecore (KProtocolManager): ERROR: Protocol  not found
Unable to initialize threads: cannot find class java/lang/Thread
kjas: ERROR: could not parse length out of:
kjas: ERROR: could not parse length out of:

BUT, I can not really understand what would be wrong.
It seems that the 'threads' error might be the clue....

Anyone who has a suggestion here?

Btw, I also tried Netscape's Java, but with similar restults.

    - John

--
John van der Ploeg
http://jvdploe.speed.planet.nl/~jvdploe   (direct)
http://home.planet.nl/~jvdploe            (mirror op planet)

2. "Trustworthy computing" ...

3. Fax modems -- class 1, class 2, class 2.0 -- whats going on?

4. installing problem in Aha-2940U/W and IBM DFRS-S2W ..

5. One Process/Thread Pool Per User Server Design

6. need help learning Bash...

7. Bio pool & scsi scatter gather pool usage

8. Solved: Slow ethernet LAN

9. Using Apache resource pools for thread-safe operations

10. Any good book on thread pooling load balancing server design

11. thread create vs. pool

12. thread class library

13. Threading C++ Class Instances