| > Try this.
| > 
| > void *serverstart(void *ptr)
| > {
| >     int sd2;
| > 
| >     sd2 = *((int *) ptr);
| >     ...
| > }
| 
| There is a race condition.  You're passing sd2's address to serverstart()
| and inside serverstart() you def' the pointer.  What if
| "sd2=accept(sd, (struct sockaddr*)&cad, &alen)" gets
| executed before your previous serverstart() finishs "sd2 = *((int*)ptr)"?

Since accept isn't atomic, it would be best to enclose the whole sha-bang in
a mutex up until the sd2 = *((int *) ptr) call finishes.
--
Dan Moschuk ([EMAIL PROTECTED])
"Try not.  Do, or do not.  There is no try."
                        -- Yoda


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to