Advertisement

Question about passing values to a thread

Started by April 14, 2005 09:25 AM
0 comments, last by 255 19 years, 6 months ago
Hello, I'm writing a server program in linux, and my plans are to have a main Socket class that will be listening for incoming clients... What I want to do is when a client joins the server I want the socket class to pass this client over to another class. now, the catch here is that this other class will be running in a seperate thread. Is there a way I can pass data to a specific thread if I have the thread ID? Basically, I will have a class with several instances running in separate threads and I'll want to have clients sent to specific threads based on the client info.... Thanks for the help Mike
Michael RhodesTiger Studios Web Designhttp://tigerstudios.net
You need to share some data between the threads and control access to it using mutexes. Condition variables might be useful too if your worker threads need to wait for client data.
Here is a very good tutorial on pthreads.

This topic is closed to new replies.

Advertisement