Discussion:
Thread safe
(too old to reply)
t***@gmail.com
2006-09-27 06:37:52 UTC
Permalink
When calling HttpOpenRequest (in async mode), I pass a custom
context object which I later reference in the "StatusCallBack"
function (status code INTERNET_STATUS_REQUEST_COMPLETE)

Is it safe to assume that the context object manipulation can be done
without taking any thread safety precautions?

Thanks!
Vladimir Scherbina
2006-09-27 08:15:11 UTC
Permalink
You *should* synchronize the access to object data when dealing with async
wininet mode.
--
Vladimir
Post by t***@gmail.com
When calling HttpOpenRequest (in async mode), I pass a custom
context object which I later reference in the "StatusCallBack"
function (status code INTERNET_STATUS_REQUEST_COMPLETE)
Is it safe to assume that the context object manipulation can be done
without taking any thread safety precautions?
Thanks!
t***@gmail.com
2006-09-28 08:11:15 UTC
Permalink
Thanks for the reply,

So what you are saying is that WinInet might call
INTERNET_STATUS_REQUEST_COMPLETE callback, on the same request handle
in two different threads simultaneously?
Post by Vladimir Scherbina
You *should* synchronize the access to object data when dealing with async
wininet mode.
--
Vladimir
Post by t***@gmail.com
When calling HttpOpenRequest (in async mode), I pass a custom
context object which I later reference in the "StatusCallBack"
function (status code INTERNET_STATUS_REQUEST_COMPLETE)
Is it safe to assume that the context object manipulation can be done
without taking any thread safety precautions?
Thanks!
Vladimir Scherbina
2006-09-28 11:12:04 UTC
Permalink
[...]
Post by t***@gmail.com
So what you are saying is that WinInet might call
INTERNET_STATUS_REQUEST_COMPLETE callback, on the same request handle
in two different threads simultaneously?
No. It will call it once. I tried to tell you that when you pass context
object to callback it might be accessed by several threads in callback
routine.
--
Vladimir
t***@gmail.com
2006-09-28 15:31:13 UTC
Permalink
But I pass a new context per call to HttpOpenRequest
Post by Vladimir Scherbina
[...]
Post by t***@gmail.com
So what you are saying is that WinInet might call
INTERNET_STATUS_REQUEST_COMPLETE callback, on the same request handle
in two different threads simultaneously?
No. It will call it once. I tried to tell you that when you pass context
object to callback it might be accessed by several threads in callback
routine.
--
Vladimir
Vladimir Scherbina
2006-09-28 18:11:20 UTC
Permalink
Fine. Then don't care about syncronization.
--
Vladimir
Post by t***@gmail.com
But I pass a new context per call to HttpOpenRequest
Post by Vladimir Scherbina
[...]
Post by t***@gmail.com
So what you are saying is that WinInet might call
INTERNET_STATUS_REQUEST_COMPLETE callback, on the same request handle
in two different threads simultaneously?
No. It will call it once. I tried to tell you that when you pass context
object to callback it might be accessed by several threads in callback
routine.
--
Vladimir
Loading...