- Notifications
You must be signed in to change notification settings - Fork5
Commit807b453
committed
Clean up thread management in parallel pg_dump for Windows.
Since we start the worker threads with _beginthreadex(), we should use_endthreadex() to terminate them. We got this right in the normal-exitcode path, but not so much during an error exit from a worker.In addition, be sure to apply CloseHandle to the thread handle aftereach thread exits.It's not clear that these oversights cause any user-visible problems,since the pg_dump run is about to terminate anyway. Still, it's clearlybetter to follow Microsoft's API specifications than ignore them.Also a few cosmetic cleanups in WaitForTerminatingWorkers(), includingbeing a bit less random about where to cast between uintptr_t and HANDLE,and being sure to clear the worker identity field for each dead worker(not that false matches should be possible later, but let's be careful).Original observation and patch by Armin Schöffmann, cosmetic improvementsby Michael Paquier and me. (Armin's patch also included closing socketsin ShutdownWorkersHard(), but that's been dealt with already in commitdf8d2d8.) Back-patch to 9.3 where parallel pg_dump was introduced.Discussion: <zarafa.570306bd.3418.074bf1420d8f2ba2@root.aegaeon.de>1 parentd81ecb9 commit807b453
2 files changed
+37
-18
lines changedLines changed: 36 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
330 |
| - | |
| 330 | + | |
331 | 331 |
| |
332 | 332 |
| |
333 | 333 |
| |
| |||
338 | 338 |
| |
339 | 339 |
| |
340 | 340 |
| |
| 341 | + | |
341 | 342 |
| |
342 | 343 |
| |
343 | 344 |
| |
| 345 | + | |
344 | 346 |
| |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
350 |
| - | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
351 | 358 |
| |
| 359 | + | |
| 360 | + | |
352 | 361 |
| |
353 | 362 |
| |
| 363 | + | |
354 | 364 |
| |
355 | 365 |
| |
356 |
| - | |
| 366 | + | |
357 | 367 |
| |
358 | 368 |
| |
359 |
| - | |
| 369 | + | |
| 370 | + | |
360 | 371 |
| |
361 |
| - | |
| 372 | + | |
| 373 | + | |
362 | 374 |
| |
| 375 | + | |
363 | 376 |
| |
364 |
| - | |
365 |
| - | |
366 |
| - | |
367 |
| - | |
368 |
| - | |
369 |
| - | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
370 | 388 |
| |
| 389 | + | |
| 390 | + | |
371 | 391 |
| |
372 | 392 |
| |
373 |
| - | |
374 | 393 |
| |
375 | 394 |
| |
376 | 395 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
149 | 149 |
| |
150 | 150 |
| |
151 | 151 |
| |
152 |
| - | |
| 152 | + | |
153 | 153 |
| |
154 | 154 |
| |
155 | 155 |
| |
|
0 commit comments
Comments
(0)