UrlRequest: fix race condition
* The thread could set fRunning to false before the caller had set it to true, leading to a stalled request. * Happened easily when testing "data" requests, which are fast since no I/O is involved. * Possibly also helps with stalled redirects on Google search I've been seeing for some time.
This commit is contained in:
parent
a4e5af66f1
commit
7bc2acc216
@ -53,6 +53,8 @@ BUrlRequest::Run()
|
|||||||
if (fThreadId < B_OK)
|
if (fThreadId < B_OK)
|
||||||
return fThreadId;
|
return fThreadId;
|
||||||
|
|
||||||
|
fRunning = true;
|
||||||
|
|
||||||
status_t launchErr = resume_thread(fThreadId);
|
status_t launchErr = resume_thread(fThreadId);
|
||||||
if (launchErr < B_OK) {
|
if (launchErr < B_OK) {
|
||||||
PRINT(("BUrlRequest::Run() : Failed to resume thread %" B_PRId32 "\n",
|
PRINT(("BUrlRequest::Run() : Failed to resume thread %" B_PRId32 "\n",
|
||||||
@ -60,7 +62,6 @@ BUrlRequest::Run()
|
|||||||
return launchErr;
|
return launchErr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fRunning = true;
|
|
||||||
return fThreadId;
|
return fThreadId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user