:thread(warning): Thread <name> could not be started!

I am not sure if I should be posting this question here, but since I had tried installing Panda3D from both RPM and compiling from source, and I thought that my problem might have been in the options. (The Panda3D I am currently using is installed from RPM).

Note: I am programming in C++.

The problem is exactly what the topic name says, I can’t start threads! I read from the documentation that when using the Thread class, you need to subclass from it and then override the thread_main() function, and then call Thread::start(ThreadPriority,bool). But when I do, the run time message (the topic name) appears and my thread doesn’t work. It doesn’t crash though.

I also tried to check if threading is supported via bool Thread::is_threading_supported(void). Unforunately for me, threading is really not supported. I am quite puzzled why it isn’t supported.

Should thread support be included when I install Panda3D? And how can I do that if I install from RPM? (the RPM I have is panda3d-1.4.2-fedora5.i386.rpm). Thanks a bunch!

Threading support is a compile-time option in Panda. We presently don’t enable it in the public builds, because enabling threading causes a (small) performance hit across the board, and if you aren’t planning on using it it’s better not to have it. Also, the threading support in Panda is not quite as complete yet as we plan it to be one day.

If you want to use threading with Panda, you’ll have to compile your own version.

David

Hmmmm… If threads aren’t the way to go, will AsyncTasks be able to substitute? (I assume that AsyncTasks are supported in public builds).

Substitute for what purpose? Anything you can do with threads, you can do without, it’s just a little harder sometimes. (And usually, it’s a little easier). What’s your application?

Its the server side application of a mmo project. I’ve been considering making the server application using Panda3D libraries since I heard that ToonTown and Pirates of the Carribean Online uses them. Also, the client side of the game itself might be done using Python / Panda3D. And also, I read that application development using python is great, even though I don’t know how to use python, yet.

Anyway, my idea is that I have one dedicated thread handling log-ins, another thread handling client-server connections, etc. It should be able to handle atleast 1000 concurrent connections per server. So I here I thought that my life would be a lot easier if I use threads. Any suggestions?

You’re better off using non-blocking sockets, and polling repeatedly. Each pass, walk through all of your currently open sockets, and service them one at a time. Then go back and do it again.

On a single-CPU machine, this is faster than using threads, and it’s much less likely to cause you programming headaches.

David

Agree with David. Also, don’t forget that Panda3D is event-driven. Event-driven naturally lends itself to multiple connections without threads.

I see, I see. Thank you guys very much for those pointers. I’m sure I’ll be using those tips. Sorry for the late reply, though, the weekend called me.