Comment detail

続・ファイル内の重複行削除 (Nested Flatten)

This comment is reply for 3533 raynstard: 見直していて94行目がまずいことに気がつ...(続・ファイル内の重複行削除). Go to thread root.

L:17以降の差分は嘘です。 @@ -162,10 +167,8 @@
連続投稿申し訳ないです。

オープンはプロセス内で排他制御しないといけないので
クローズの時だけ排他制御を追加すれば
問題ないはずでした。
うーん、いろいろ歪みががが
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
--- 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;

Index

Feed

Other

Link

Pathtraq

loading...