Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Bjørnar Nielsen
I have a similar design, but I also have a pointer to the thread in the THttpConnection so that the connection can set a flag on the thread if the connection is dropped before the thread has finished the work and risk using a freed connection. This design could serve several connections/threads

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Guillaume MAISON
Bjørnar Nielsen a écrit : I have a similar design, but I also have a pointer to the thread in the THttpConnection so that the connection can set a flag on the thread if the connection is dropped before the thread has finished the work and risk using a freed connection. True ! i haven't seen

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Dod
Hello Guillaume, Until know what I use to do is to create a worker thread and send jobs (with pointer to socket client object) and then worker send back a message to socket thread with pointer of data to send back to client. So all socket things is done from same thread. Dettaching

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Guillaume MAISON
Dod a écrit : Hello Guillaume, Until know what I use to do is to create a worker thread and send jobs (with pointer to socket client object) and then worker send back a message to socket thread with pointer of data to send back to client. So all socket things is done from same thread.

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Guillaume MAISON
Dod a écrit : Ok so you do nearly same as me. But at the end of threaded job I verify the client still exists before sending result. When a session connect I set a SessionID incremental counter in MySocketClient class because I noticed that same socket handle can be re-used by

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Francois Piette
What you're doing is transfering a socket from main thread context to your work thread context. My purpose is not the following. What i mean is executing all the SQL stuff within the thread, and the connection stuff within the main thread. That's what I do with my MidWare threaded

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Dod
Hello Francois, Exactly what I do now, but what reference do you pass to thread ? At beginning I did it with socket.handle (if I remember well by it was long time ago) by I noticed that if during work job the socket is closed and a new connexion come, then it could happend that this

Re: [twsocket] [QUESTION] ThttpServer and threading design

2006-02-09 Thread Guillaume MAISON
Francois Piette a écrit : That's what I do with my MidWare threaded TServerObject. You can apply the same logic to the HttpServer component. I have a class which manage a pool of threads. When a request comes in, I get a thread from the pool, adding a new one if necessary. The thread