Reimplement async procedures using pthreads

On Windows, async procedures have always been run in threads, and the
implementation used Windows specific APIs. Rewrite the code to use pthreads.

A new configuration option is introduced so that the threaded implementation
can also be used on POSIX systems. Since this option is intended only as
playground on POSIX, but is mandatory on Windows, the option is not
documented.

One detail is that on POSIX it is necessary to set FD_CLOEXEC on the pipe
handles. On Windows, this is not needed because pipe handles are not
inherited to child processes, and the new calls to set_cloexec() are
effectively no-ops.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
3 files changed
tree: 997a47438fe7e1ff3a9f649cc1f720c47dee4111
  1. block-sha1/
  2. compat/
  3. contrib/
  4. Documentation/
  5. git-gui/
  6. git_remote_helpers/
  7. gitk-git/
  8. gitweb/
  9. perl/
  10. ppc/
  11. t/
  12. templates/
  13. xdiff/
  14. .gitattributes
  15. .gitignore
  16. .mailmap
  17. abspath.c
  18. advice.c
  19. advice.h
  20. alias.c
  21. alloc.c
  22. archive-tar.c
  23. archive-zip.c
  24. archive.c
  25. archive.h
  26. attr.c
  27. attr.h
  28. base85.c
  29. bisect.c
  30. bisect.h
  31. blob.c
  32. blob.h
  33. branch.c
  34. branch.h
  35. builtin-add.c
  36. builtin-annotate.c
  37. builtin-apply.c
  38. builtin-archive.c
  39. builtin-bisect--helper.c
  40. builtin-blame.c
  41. builtin-branch.c
  42. builtin-bundle.c
  43. builtin-cat-file.c
  44. builtin-check-attr.c
  45. builtin-check-ref-format.c
  46. builtin-checkout-index.c
  47. builtin-checkout.c
  48. builtin-clean.c
  49. builtin-clone.c
  50. builtin-commit-tree.c
  51. builtin-commit.c
  52. builtin-config.c
  53. builtin-count-objects.c
  54. builtin-describe.c
  55. builtin-diff-files.c
  56. builtin-diff-index.c
  57. builtin-diff-tree.c
  58. builtin-diff.c
  59. builtin-fast-export.c
  60. builtin-fetch-pack.c
  61. builtin-fetch.c
  62. builtin-fmt-merge-msg.c
  63. builtin-for-each-ref.c
  64. builtin-fsck.c
  65. builtin-gc.c
  66. builtin-grep.c
  67. builtin-hash-object.c
  68. builtin-help.c
  69. builtin-index-pack.c
  70. builtin-init-db.c
  71. builtin-log.c
  72. builtin-ls-files.c
  73. builtin-ls-remote.c
  74. builtin-ls-tree.c
  75. builtin-mailinfo.c
  76. builtin-mailsplit.c
  77. builtin-merge-base.c
  78. builtin-merge-file.c
  79. builtin-merge-index.c
  80. builtin-merge-ours.c
  81. builtin-merge-recursive.c
  82. builtin-merge-tree.c
  83. builtin-merge.c
  84. builtin-mktag.c
  85. builtin-mktree.c
  86. builtin-mv.c
  87. builtin-name-rev.c
  88. builtin-pack-objects.c
  89. builtin-pack-redundant.c
  90. builtin-pack-refs.c
  91. builtin-patch-id.c
  92. builtin-prune-packed.c
  93. builtin-prune.c
  94. builtin-push.c
  95. builtin-read-tree.c
  96. builtin-receive-pack.c
  97. builtin-reflog.c
  98. builtin-remote.c
  99. builtin-replace.c
  100. builtin-rerere.c
  101. builtin-reset.c
  102. builtin-rev-list.c
  103. builtin-rev-parse.c
  104. builtin-revert.c
  105. builtin-rm.c
  106. builtin-send-pack.c
  107. builtin-shortlog.c
  108. builtin-show-branch.c
  109. builtin-show-ref.c
  110. builtin-stripspace.c
  111. builtin-symbolic-ref.c
  112. builtin-tag.c
  113. builtin-tar-tree.c
  114. builtin-unpack-file.c
  115. builtin-unpack-objects.c
  116. builtin-update-index.c
  117. builtin-update-ref.c
  118. builtin-update-server-info.c
  119. builtin-upload-archive.c
  120. builtin-var.c
  121. builtin-verify-pack.c
  122. builtin-verify-tag.c
  123. builtin-write-tree.c
  124. builtin.h
  125. bundle.c
  126. bundle.h
  127. cache-tree.c
  128. cache-tree.h
  129. cache.h
  130. check-builtins.sh
  131. check-racy.c
  132. check_bindir
  133. color.c
  134. color.h
  135. combine-diff.c
  136. command-list.txt
  137. commit.c
  138. commit.h
  139. config.c
  140. config.mak.in
  141. configure.ac
  142. connect.c
  143. convert.c
  144. copy.c
  145. COPYING
  146. csum-file.c
  147. csum-file.h
  148. ctype.c
  149. daemon.c
  150. date.c
  151. decorate.c
  152. decorate.h
  153. delta.h
  154. diff-delta.c
  155. diff-lib.c
  156. diff-no-index.c
  157. diff.c
  158. diff.h
  159. diffcore-break.c
  160. diffcore-delta.c
  161. diffcore-order.c
  162. diffcore-pickaxe.c
  163. diffcore-rename.c
  164. diffcore.h
  165. dir.c
  166. dir.h
  167. editor.c
  168. entry.c
  169. environment.c
  170. exec_cmd.c
  171. exec_cmd.h
  172. fast-import.c
  173. fetch-pack.h
  174. fixup-builtins
  175. fsck.c
  176. fsck.h
  177. generate-cmdlist.sh
  178. git-add--interactive.perl
  179. git-am.sh
  180. git-archimport.perl
  181. git-bisect.sh
  182. git-compat-util.h
  183. git-cvsexportcommit.perl
  184. git-cvsimport.perl
  185. git-cvsserver.perl
  186. git-difftool--helper.sh
  187. git-difftool.perl
  188. git-filter-branch.sh
  189. git-instaweb.sh
  190. git-lost-found.sh
  191. git-merge-octopus.sh
  192. git-merge-one-file.sh
  193. git-merge-resolve.sh
  194. git-mergetool--lib.sh
  195. git-mergetool.sh
  196. git-notes.sh
  197. git-parse-remote.sh
  198. git-pull.sh
  199. git-quiltimport.sh
  200. git-rebase--interactive.sh
  201. git-rebase.sh
  202. git-relink.perl
  203. git-repack.sh
  204. git-request-pull.sh
  205. git-send-email.perl
  206. git-sh-setup.sh
  207. git-stash.sh
  208. git-submodule.sh
  209. git-svn.perl
  210. GIT-VERSION-GEN
  211. git-web--browse.sh
  212. git.c
  213. git.spec.in
  214. graph.c
  215. graph.h
  216. grep.c
  217. grep.h
  218. hash.c
  219. hash.h
  220. help.c
  221. help.h
  222. hex.c
  223. http-backend.c
  224. http-fetch.c
  225. http-push.c
  226. http-walker.c
  227. http.c
  228. http.h
  229. ident.c
  230. imap-send.c
  231. INSTALL
  232. levenshtein.c
  233. levenshtein.h
  234. list-objects.c
  235. list-objects.h
  236. ll-merge.c
  237. ll-merge.h
  238. lockfile.c
  239. log-tree.c
  240. log-tree.h
  241. mailmap.c
  242. mailmap.h
  243. Makefile
  244. match-trees.c
  245. merge-file.c
  246. merge-recursive.c
  247. merge-recursive.h
  248. name-hash.c
  249. notes.c
  250. notes.h
  251. object.c
  252. object.h
  253. pack-check.c
  254. pack-refs.c
  255. pack-refs.h
  256. pack-revindex.c
  257. pack-revindex.h
  258. pack-write.c
  259. pack.h
  260. pager.c
  261. parse-options.c
  262. parse-options.h
  263. patch-delta.c
  264. patch-ids.c
  265. patch-ids.h
  266. path.c
  267. pkt-line.c
  268. pkt-line.h
  269. preload-index.c
  270. pretty.c
  271. progress.c
  272. progress.h
  273. quote.c
  274. quote.h
  275. reachable.c
  276. reachable.h
  277. read-cache.c
  278. README
  279. reflog-walk.c
  280. reflog-walk.h
  281. refs.c
  282. refs.h
  283. remote-curl.c
  284. remote.c
  285. remote.h
  286. replace_object.c
  287. rerere.c
  288. rerere.h
  289. resolve-undo.c
  290. resolve-undo.h
  291. revision.c
  292. revision.h
  293. run-command.c
  294. run-command.h
  295. send-pack.h
  296. server-info.c
  297. setup.c
  298. sha1-lookup.c
  299. sha1-lookup.h
  300. sha1_file.c
  301. sha1_name.c
  302. shallow.c
  303. shell.c
  304. shortlog.h
  305. show-index.c
  306. sideband.c
  307. sideband.h
  308. sigchain.c
  309. sigchain.h
  310. strbuf.c
  311. strbuf.h
  312. string-list.c
  313. string-list.h
  314. submodule.c
  315. submodule.h
  316. symlinks.c
  317. tag.c
  318. tag.h
  319. tar.h
  320. test-chmtime.c
  321. test-ctype.c
  322. test-date.c
  323. test-delta.c
  324. test-dump-cache-tree.c
  325. test-genrandom.c
  326. test-index-version.c
  327. test-match-trees.c
  328. test-parse-options.c
  329. test-path-utils.c
  330. test-run-command.c
  331. test-sha1.c
  332. test-sha1.sh
  333. test-sigchain.c
  334. thread-utils.c
  335. thread-utils.h
  336. trace.c
  337. transport-helper.c
  338. transport.c
  339. transport.h
  340. tree-diff.c
  341. tree-walk.c
  342. tree-walk.h
  343. tree.c
  344. tree.h
  345. unimplemented.sh
  346. unpack-trees.c
  347. unpack-trees.h
  348. upload-pack.c
  349. usage.c
  350. userdiff.c
  351. userdiff.h
  352. utf8.c
  353. utf8.h
  354. walker.c
  355. walker.h
  356. wrap-for-bin.sh
  357. wrapper.c
  358. write_or_die.c
  359. ws.c
  360. wt-status.c
  361. wt-status.h
  362. xdiff-interface.c
  363. xdiff-interface.h