--- doukaku67_2.c	2007-10-27 11:40:13.265625000 +0900
+++ doukaku67.c.usethread	2007-10-27 11:54:29.687500000 +0900
@@ -91,7 +91,12 @@
     } else {
       if( (table_fd = open(table_name, O_RDWR | O_CREAT, 0600)) == -1 ){ return -1; }
     }
-    if( fd_history[hist_cursor].fd != -1 ) close( fd_history[hist_cursor].fd );
+    if( fd_history[hist_cursor].fd != -1 )
+    {
+      pthread_mutex_lock( &hash_mutex[ fd_history[hist_cursor].val ] );
+        close( fd_history[hist_cursor].fd );
+      pthread_mutex_unlock( &hash_mutex[ fd_history[hist_cursor].val ] );
+    }
     fd_history[hist_cursor].val= hash_value;
     fd_history[hist_cursor].fd = table_fd;
     hist_cursor++; hist_cursor &= 0x7f;
