[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Backport fixes for task #43: make worker threads start and ...
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] Backport fixes for task #43: make worker threads start and ...
- From: nickm@xxxxxxxx (Nick Mathewson)
- Date: Mon, 3 Jan 2005 14:27:35 -0500 (EST)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Mon, 03 Jan 2005 14:28:11 -0500
- Reply-to: or-dev@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv26706/src/common
Modified Files:
Tag: tor-0_0_9-patches
compat.c compat.h
Log Message:
Backport fixes for task #43: make worker threads start and run on win32.
Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.22.2.1
retrieving revision 1.22.2.2
diff -u -d -r1.22.2.1 -r1.22.2.2
--- compat.c 22 Dec 2004 02:57:32 -0000 1.22.2.1
+++ compat.c 3 Jan 2005 19:27:31 -0000 1.22.2.2
@@ -323,6 +323,7 @@
}
fd[0] = connector;
fd[1] = acceptor;
+
return 0;
abort_tidy_up_and_fail:
@@ -510,6 +511,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)
Index: compat.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.h,v
retrieving revision 1.13.2.1
retrieving revision 1.13.2.2
diff -u -d -r1.13.2.1 -r1.13.2.2
--- compat.h 22 Dec 2004 02:57:32 -0000 1.13.2.1
+++ compat.h 3 Jan 2005 19:27:31 -0000 1.13.2.2
@@ -189,5 +189,11 @@
void tor_mutex_release(tor_mutex_t *m);
void tor_mutex_free(tor_mutex_t *m);
+#ifdef MS_WINDOWS
+#define TOR_IS_MULTITHREADED 1
+#else
+#undef TOR_IS_MULTITHREADED
+#endif
+
#endif