--- netcam.c	2005-10-09 20:24:13.000000000 +0800
+++ netcam.c	2005-10-20 08:02:56.000000000 +0800
@@ -1802,6 +1802,12 @@
 	netcam->latest->ptr = mymalloc(NETCAM_BUFFSIZE);
 	netcam->timeout.tv_sec = READ_TIMEOUT;
 
+	/* Thread control structures */
+	pthread_mutex_init(&netcam->mutex, NULL);
+	pthread_cond_init(&netcam->cap_cond, NULL);
+	pthread_cond_init(&netcam->pic_ready, NULL);
+	pthread_cond_init(&netcam->exiting, NULL);
+	
 	/* Initialise the average frame time to the user's value */
 	netcam->av_frame_time = 1000000.0 / cnt->conf.frame_limit;
 
@@ -1916,10 +1922,6 @@
 	 * Everything is now ready - start up the
 	 * "handler thread".
 	 */
-	pthread_mutex_init(&netcam->mutex, NULL);
-	pthread_cond_init(&netcam->cap_cond, NULL);
-	pthread_cond_init(&netcam->pic_ready, NULL);
-	pthread_cond_init(&netcam->exiting, NULL);
 	pthread_attr_init(&handler_attribute);
 	pthread_attr_setdetachstate(&handler_attribute, PTHREAD_CREATE_DETACHED);
 	pthread_mutex_lock(&global_lock);
