Ok hehehe I think I did something wrong cause now when I try to view the web
server for my test port it just sits there and sits there and then says it
can't find the page. And I noticed, I typed ps ux in the shell and well I
got:

realms   28382  0.0  0.0  2224  988 ?        S    16:35   0:00 /bin/csh
./startu
realms   28383  8.1  1.7 24984 18204 ?       S    16:35   0:09 ../src/rom
4998
realms   28385  0.0  1.7 24984 18204 ?       S    16:36   0:00 ../src/rom
4998
realms   28386  0.0  1.7 24984 18204 ?       S    16:36   0:00 ../src/rom
4998

So I'll show you what I did maybe someone can point out where I messed up.

 sem_init (&web_queue, 0, 0);
 pthread_create (&web_thread, NULL, &handle_web, NULL);
// pthread_detach(web_thread);
 web_server_down = FALSE;
 return;

}

That is the bottom of my init_web function that opens the port and fires up
the web server.

Then I changed the handle_web to look like this:

void* handle_web(void* unused)

At the bottom I had it do this :

 pthread_exit(NULL);
 return NULL;
}

Now in handle_web I made the top look like this:

void* handle_web(void* unused)
{
 int max_fd;
 WEB_DESCRIPTOR *current, **prev, *next;
 WEB_USER *webuser, *webuser_next, **webuser_prev;
 fd_set readfds, writefds, execfds;
 struct timeval ZERO_TIME = { 0, 0 };

 FD_ZERO(&readfds);
 FD_ZERO(&writefds);
 FD_ZERO(&execfds);
 FD_SET(sockfd, &readfds);

 /* it *will* be atleast sockfd */
 max_fd = sockfd;

 while(!web_server_down)
 {
 /* add in all the current web descriptors */

  sem_wait(&web_queue);

  for(current = web_descs; current != NULL; current = current->next)
  {
       FD_SET(current->fd, &readfds);
       FD_SET(current->fd, &writefds);
       FD_SET(current->fd, &execfds);
       if(max_fd < current->fd)
    max_fd = current->fd;
  }


And then in game_loop_unix where i used to call handle_web I change that to:

  update_handler( );
//  handle_web(); // check webserver
  sem_post(&web_queue);


So anyone see where I messed up?


Reply via email to