Hmm... threads shouden't appear as seperate processes with different PIDs, instead, they should be all part of one process.
I don't know what's going on here, but it dosen't look right. On the other hand, if it works properly, I wouden't worry too much about it :) On Thursday 07 August 2003 18:21, Dale Kingston wrote: > Ok well I fixed that problem was my stupid... But is it still sapose to > look like this when I typed ps ux: > > realms 30203 1.5 1.8 25732 18928 ? S 18:32 0:43 ../src/rom > 4998 > realms 30207 0.0 1.8 25732 18928 ? S 18:32 0:00 ../src/rom > 4998 > realms 30208 0.0 1.8 25732 18928 ? S 18:32 0:00 ../src/rom > 4998 > > Is it normal to now have it show up three times? > ----- Original Message ----- > From: "Dale Kingston" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Thursday, August 07, 2003 2:44 PM > Subject: Threads problem > > > 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? > > > > > > -- > > ROM mailing list > > [email protected] > > http://www.rom.org/cgi-bin/mailman/listinfo/rom

