Gerrit Bruchhäuser pointed out a warning that the Intel(R) Thread Checker
authorDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jun 2007 14:23:38 +0000 (14:23 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 21 Jun 2007 14:23:38 +0000 (14:23 +0000)
tool reports and it was indeed a legitimate one and it is one fixed. It was
a use of a share without doing the proper locking first.

CHANGES
RELEASE-NOTES
lib/url.c
tests/data/test506

diff --git a/CHANGES b/CHANGES
index 18bdd01..38a734f 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,11 @@
 
                                   Changelog
 
+Daniel S (21 June 2007)
+- Gerrit Bruchhäuser pointed out a warning that the Intel(R) Thread Checker
+  tool reports and it was indeed a legitimate one and it is one fixed. It was
+  a use of a share without doing the proper locking first.
+  
 Daniel S (20 June 2007)
 - Adam Piggott filed bug report #1740263
   (http://curl.haxx.se/bug/view.cgi?id=1740263). Adam discovered that when
index 21fa2b5..dc4b1f5 100644 (file)
@@ -60,6 +60,7 @@ This release includes the following bugfixes:
  o multi interface HTTP CONNECT glitch
  o list FTP root directories when login dir is not root
  o no longer slows down when getting very many URLs on the same command line
+ o lock share before decreasing dirty counter
 
 This release includes the following known bugs:
 
@@ -86,6 +87,7 @@ advice from friends like these:
  Frank Hempel, Michael Wallner, Jeff Pohlmeyer, Tobias Rundström,
  Anders Gustafsson, James Bursa, Kristian Gunstone, Feng Tu,
  Andre Guibert de Bruet, Rob Crittenden, Rich Rauenzahn, Tom Regner,
- Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott
+ Dave Vasilevsky, Shmulik Regev, Robson Braga Araujo, Adam Piggott,
+ Gerrit Bruchhäuser
 
         Thanks! (and sorry if I forgot to mention someone)
index 8165c92..7899597 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -378,8 +378,11 @@ CURLcode Curl_close(struct SessionHandle *data)
 #endif /* CURL_DOES_CONVERSIONS && HAVE_ICONV */
 
   /* No longer a dirty share, if it exists */
-  if (data->share)
+  if (data->share) {
+    Curl_share_lock(data, CURL_LOCK_DATA_SHARE, CURL_LOCK_ACCESS_SINGLE);
     data->share->dirty--;
+    Curl_share_unlock(data, CURL_LOCK_DATA_SHARE);
+  }
 
   free(data);
   return CURLE_OK;
index 1d658f3..65a2758 100644 (file)
@@ -90,60 +90,66 @@ lock:   dns    <Pigs in space>: 16
 unlock: dns    <Pigs in space>: 17
 lock:   cookie <Pigs in space>: 18
 unlock: cookie <Pigs in space>: 19
-*** run 2
-CURLOPT_SHARE
 lock:   share  <Pigs in space>: 20
 unlock: share  <Pigs in space>: 21
+*** run 2
+CURLOPT_SHARE
+lock:   share  <Pigs in space>: 22
+unlock: share  <Pigs in space>: 23
 PERFORM
-lock:   dns    <Pigs in space>: 22
-unlock: dns    <Pigs in space>: 23
 lock:   dns    <Pigs in space>: 24
 unlock: dns    <Pigs in space>: 25
-lock:   cookie <Pigs in space>: 26
-unlock: cookie <Pigs in space>: 27
+lock:   dns    <Pigs in space>: 26
+unlock: dns    <Pigs in space>: 27
 lock:   cookie <Pigs in space>: 28
 unlock: cookie <Pigs in space>: 29
 lock:   cookie <Pigs in space>: 30
 unlock: cookie <Pigs in space>: 31
+lock:   cookie <Pigs in space>: 32
+unlock: cookie <Pigs in space>: 33
 run 2: set cookie 4 and 5
-lock:   dns    <Pigs in space>: 32
-unlock: dns    <Pigs in space>: 33
-CLEANUP
 lock:   dns    <Pigs in space>: 34
 unlock: dns    <Pigs in space>: 35
-lock:   cookie <Pigs in space>: 36
-unlock: cookie <Pigs in space>: 37
+CLEANUP
+lock:   dns    <Pigs in space>: 36
+unlock: dns    <Pigs in space>: 37
+lock:   cookie <Pigs in space>: 38
+unlock: cookie <Pigs in space>: 39
+lock:   share  <Pigs in space>: 40
+unlock: share  <Pigs in space>: 41
 *** run 3
 CURLOPT_SHARE
-lock:   share  <Pigs in space>: 38
-unlock: share  <Pigs in space>: 39
+lock:   share  <Pigs in space>: 42
+unlock: share  <Pigs in space>: 43
 CURLOPT_COOKIEJAR
 PERFORM
-lock:   dns    <Pigs in space>: 40
-unlock: dns    <Pigs in space>: 41
-lock:   dns    <Pigs in space>: 42
-unlock: dns    <Pigs in space>: 43
-lock:   cookie <Pigs in space>: 44
-unlock: cookie <Pigs in space>: 45
-lock:   cookie <Pigs in space>: 46
-unlock: cookie <Pigs in space>: 47
+lock:   dns    <Pigs in space>: 44
+unlock: dns    <Pigs in space>: 45
+lock:   dns    <Pigs in space>: 46
+unlock: dns    <Pigs in space>: 47
 lock:   cookie <Pigs in space>: 48
 unlock: cookie <Pigs in space>: 49
+lock:   cookie <Pigs in space>: 50
+unlock: cookie <Pigs in space>: 51
+lock:   cookie <Pigs in space>: 52
+unlock: cookie <Pigs in space>: 53
 run 3: overwrite cookie 1 and 4
-lock:   dns    <Pigs in space>: 50
-unlock: dns    <Pigs in space>: 51
+lock:   dns    <Pigs in space>: 54
+unlock: dns    <Pigs in space>: 55
 try SHARE_CLEANUP...
-lock:   share  <Pigs in space>: 52
-unlock: share  <Pigs in space>: 53
+lock:   share  <Pigs in space>: 56
+unlock: share  <Pigs in space>: 57
 SHARE_CLEANUP failed, correct
 CLEANUP
-lock:   dns    <Pigs in space>: 54
-unlock: dns    <Pigs in space>: 55
-lock:   cookie <Pigs in space>: 56
-unlock: cookie <Pigs in space>: 57
+lock:   dns    <Pigs in space>: 58
+unlock: dns    <Pigs in space>: 59
+lock:   cookie <Pigs in space>: 60
+unlock: cookie <Pigs in space>: 61
+lock:   share  <Pigs in space>: 62
+unlock: share  <Pigs in space>: 63
 SHARE_CLEANUP
-lock:   share  <Pigs in space>: 58
-unlock: share  <Pigs in space>: 59
+lock:   share  <Pigs in space>: 64
+unlock: share  <Pigs in space>: 65
 GLOBAL_CLEANUP
 </stdout>
 <stderr>