cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Intel(R) Thread Checker report

From: Gerrit Bruchhäuser <gbruchhaeuser_at_nero.com>
Date: Thu, 21 Jun 2007 08:42:21 +0200

> I'm not aware of any dual-core problems. What exactly are you suggesting we
> should add to the FAQ?

A short note like:
        cURL shares counter variables among threads without mutex protection. This
should not cause problems on systems where incrementing and/or decrementing
integer variables is an atomar operation. However, please be aware that It
may lead to problems on other systems.
It is known that Intel(R) Thread Checker reports an error on this.

> Indeed "volatile" does not help at all with thread safety. Daniel,
> are you using it anywhere?

share.h
        #define CURL_VOLATILE volatile
        CURL_VOLATILE unsigned int dirty;

Simultaniously allowing threads to enter 'curl_easy_setopt' (with different
easy_handles) produced the following report:

Read -> Write data-race Error "url.c":233
    Memory write at "url.c":379 conflicts with a prior memory read
at "url.c":1595 (anti dependence) "url.c":1595 "url.c":379

,----[ url.c ]
| 232 CURLcode Curl_close(struct SessionHandle *data)
| 233 {
| 379 data->share->dirty--;
| 1595 data->share->dirty++;
`----
Received on 2007-06-21