[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r8327: spawn_func fixes: have cpuworker_main and dnsworker_main con (in tor/trunk: . src/common src/or)
- To: or-cvs@xxxxxxxxxxxxx
- Subject: [or-cvs] r8327: spawn_func fixes: have cpuworker_main and dnsworker_main con (in tor/trunk: . src/common src/or)
- From: nickm@xxxxxxxx
- Date: Wed, 6 Sep 2006 04:42:20 -0400 (EDT)
- Delivered-to: archiver@seul.org
- Delivered-to: or-cvs-outgoing@seul.org
- Delivered-to: or-cvs@seul.org
- Delivery-date: Wed, 06 Sep 2006 04:42:28 -0400
- Reply-to: or-talk@xxxxxxxxxxxxx
- Sender: owner-or-cvs@xxxxxxxxxxxxx
Author: nickm
Date: 2006-09-06 04:42:20 -0400 (Wed, 06 Sep 2006)
New Revision: 8327
Modified:
tor/trunk/
tor/trunk/src/common/compat.c
tor/trunk/src/or/cpuworker.c
tor/trunk/src/or/dns.c
Log:
r8725@Kushana: nickm | 2006-09-06 04:39:29 -0400
spawn_func fixes: have cpuworker_main and dnsworker_main confirm to the right interfaces [casting func to void* is icky]. Also, make pthread_create() build without warnings.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r8725] on c95137ef-5f19-0410-b913-86e773d04f59
Modified: tor/trunk/src/common/compat.c
===================================================================
--- tor/trunk/src/common/compat.c 2006-09-06 08:42:16 UTC (rev 8326)
+++ tor/trunk/src/common/compat.c 2006-09-06 08:42:20 UTC (rev 8327)
@@ -936,14 +936,14 @@
* invoke them in a way pthreads would expect.
*/
typedef struct tor_pthread_data_t {
- int (*func)(void *);
+ void (*func)(void *);
void *data;
} tor_pthread_data_t;
static void *
tor_pthread_helper_fn(void *_data)
{
tor_pthread_data_t *data = _data;
- int (*func)(void*);
+ void (*func)(void*);
void *arg;
func = data->func;
arg = data->data;
Modified: tor/trunk/src/or/cpuworker.c
===================================================================
--- tor/trunk/src/or/cpuworker.c 2006-09-06 08:42:16 UTC (rev 8326)
+++ tor/trunk/src/or/cpuworker.c 2006-09-06 08:42:20 UTC (rev 8327)
@@ -36,7 +36,7 @@
* the last time we got a key rotation event. */
static time_t last_rotation_time=0;
-static int cpuworker_main(void *data);
+static void cpuworker_main(void *data);
static int spawn_cpuworker(void);
static void spawn_enough_cpuworkers(void);
static void process_pending_task(connection_t *cpuworker);
@@ -222,7 +222,7 @@
* (Note: this _should_ be by addr/port, since we're concerned with specific
* connections, not with routers (where we'd use identity).)
*/
-static int
+static void
cpuworker_main(void *data)
{
char question[ONIONSKIN_CHALLENGE_LEN];
@@ -308,7 +308,6 @@
tor_close_socket(fd);
crypto_thread_cleanup();
spawn_exit();
- return 0; /* windows wants this function to return an int */
}
/** Launch a new cpuworker. Return 0 if we're happy, -1 if we failed.
@@ -333,7 +332,7 @@
tor_assert(fdarray[1] >= 0);
fd = fdarray[0];
- spawn_func((void*) cpuworker_main, (void*)fdarray);
+ spawn_func(cpuworker_main, (void*)fdarray);
log_debug(LD_OR,"just spawned a cpu worker.");
#ifndef TOR_IS_MULTITHREADED
tor_close_socket(fdarray[1]); /* don't need the worker's side of the pipe */
Modified: tor/trunk/src/or/dns.c
===================================================================
--- tor/trunk/src/or/dns.c 2006-09-06 08:42:16 UTC (rev 8326)
+++ tor/trunk/src/or/dns.c 2006-09-06 08:42:20 UTC (rev 8327)
@@ -112,7 +112,7 @@
static int launch_resolve(edge_connection_t *exitconn);
#ifndef USE_EVENTDNS
static void dnsworkers_rotate(void);
-static int dnsworker_main(void *data);
+static void dnsworker_main(void *data);
static int spawn_dnsworker(void);
static int spawn_enough_dnsworkers(void);
#else
@@ -991,7 +991,7 @@
* The dnsworker runs indefinitely, until its connection is closed or an error
* occurs.
*/
-static int
+static void
dnsworker_main(void *data)
{
char address[MAX_ADDRESSLEN+1]; /* Plus a byte for a final '.' */
@@ -1079,7 +1079,6 @@
spawn_exit();
}
}
- return 0; /* windows wants this function to return an int */
}
/** Launch a new DNS worker; return 0 on success, -1 on failure.