[or-cvs] More work on task #43: fix race conditions on multithreaded...

Nick Mathewson nickm at seul.org
Mon Jan 3 19:07:27 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv25412/common

Modified Files:
	compat.c 
Log Message:
More work on task #43: fix race conditions on multithreaded (win32) servers.

Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- compat.c	22 Dec 2004 05:28:15 -0000	1.25
+++ compat.c	3 Jan 2005 19:07:24 -0000	1.26
@@ -331,6 +331,7 @@
     }
     fd[0] = connector;
     fd[1] = acceptor;
+
     return 0;
 
   abort_tidy_up_and_fail:
@@ -557,6 +558,11 @@
 /** Minimalist interface to run a void function in the background.  On
  * unix calls fork, on win32 calls beginthread.  Returns -1 on failure.
  * func should not return, but rather should call spawn_exit.
+ *
+ * NOTE: if <b>data</b> is used, it should not be allocated on the stack,
+ * since in a multithreaded environment, there is no way to be sure that
+ * the caller's stack will still be around when the called function is
+ * running.
  */
 int
 spawn_func(int (*func)(void *), void *data)



More information about the tor-commits mailing list