Hey folks,
I'm using TBB to build an app that uses BSD sockets. It's server app therefore i launch a thread that runs the accept() function.
thread_accepts_connect()
{
...
while(1)
{
client_sockfd = accept ();
ProcessSocketTask& fb = *new( tbb::task::allocate_root() ) ProcessSocketTask(client_sockfd);
fb.execute();
}
}
But there are two problems:
1 - Tasks are using I/O.
2 - Memory leaks from ProcessSocketTask
I tried a diferent approach this time instead of using tasks it used threads
problem #1 was solved. But problem #2 was still there.
Threads or Task which is the best approach?
How to release memory from Task or Threads? I don't want to do it on thread_accepts_connect because it needs to be "free" to accept connections.


