git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 00/10] Reduce #ifdef NO_PTHREADS

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Oct 27, 2018, 17:29 UTC
Message-ID
<20181027173008.18852-1-pclouds@gmail.com>
In-Reply-To
<20181027071003.1347-1-pclouds@gmail.com>

The send-pack.c patch is dropped since it's tied to async code and like transport-helper.c (or more cleanups in index-pack.c) could be left for later.

I added one more patch to shut up -Wmaybe-uninitialized but since I could not reproduce it, Jeff would need to verify if it works for him.

Nguyễn Thái Ngọc Duy (10):
  thread-utils: macros to unconditionally compile pthreads API
  index-pack: remove #ifdef NO_PTHREADS
  name-hash.c: remove #ifdef NO_PTHREADS
  attr.c: remove #ifdef NO_PTHREADS
  grep: remove #ifdef NO_PTHREADS
  preload-index.c: remove #ifdef NO_PTHREADS
  pack-objects: remove #ifdef NO_PTHREADS
  read-cache.c: remove #ifdef NO_PTHREADS
  Clean up pthread_create() error handling
  read-cache.c: initialize copy_len to shut up gcc 8
 Makefile               |  2 +-
 attr.c                 | 14 ---------
 builtin/grep.c         | 59 ++++++++++++++----------------------
 builtin/index-pack.c   | 68 +++++++++++-------------------------------
 builtin/pack-objects.c | 26 ++--------------
 grep.c                 |  6 ----
 grep.h                 |  6 ----
 name-hash.c            | 38 +++++++++--------------
 pack-objects.h         |  6 ----
 preload-index.c        | 23 +++++---------
 read-cache.c           | 53 ++++++++++++--------------------
 run-command.c          |  2 +-
 thread-utils.c         | 48 +++++++++++++++++++++++++++++
 thread-utils.h         | 48 +++++++++++++++++++++++++++--
 14 files changed, 178 insertions(+), 221 deletions(-)
Range-diff against v1:
 1:  fd4926a83a !  1:  2791c06629 thread-utils: macros to unconditionally compile pthreads API
    @@ -146,6 +146,7 @@
     +#define pthread_t int
     +#define pthread_mutex_t int
     +#define pthread_cond_t int
    ++#define pthread_key_t int
     +
     +#define pthread_mutex_init(mutex, attr) dummy_pthread_init(mutex)
     +#define pthread_mutex_lock(mutex)
 2:  47b1f63fdd =  2:  61b3efceee index-pack: remove #ifdef NO_PTHREADS
 3:  a842b27e1e =  3:  93aa33eaa6 name-hash.c: remove #ifdef NO_PTHREADS
 4:  c0939283c3 =  4:  5d9441d8e2 attr.c: remove #ifdef NO_PTHREADS
 5:  6c6f3a0d28 <  -:  ---------- send-pack.c: remove #ifdef NO_PTHREADS
 6:  9f6e259fb4 !  5:  834b19d5c6 grep: remove #ifdef NO_PTHREADS
    @@ -13,6 +13,16 @@
      static pthread_t *threads;
      
      /* We use one producer thread and THREADS consumer
    +@@
    + 	int hit = 0;
    + 	int i;
    + 
    ++	if (!HAVE_THREADS)
    ++		return 0;
    ++
    + 	grep_lock();
    + 	all_work_added = 1;
    + 
     @@
      
      	return hit;
    @@ -136,15 +146,6 @@
      
      	if (show_in_pager && (cached || list.nr))
      		die(_("--open-files-in-pager only works on the worktree"));
    -@@
    - 		hit = grep_objects(&opt, &pathspec, &list);
    - 	}
    - 
    --	if (num_threads)
    -+	if (HAVE_THREADS && num_threads)
    - 		hit |= wait_all();
    - 	if (hit && show_in_pager)
    - 		run_pager(&opt, prefix);
     
      diff --git a/grep.c b/grep.c
      --- a/grep.c
 7:  97fb2fdba4 =  6:  10969f86ae preload-index.c: remove #ifdef NO_PTHREADS
 8:  b8aeb2776b =  7:  7e83190364 pack-objects: remove #ifdef NO_PTHREADS
 9:  40a9bfb8f2 =  8:  404e9d9041 read-cache.c: remove #ifdef NO_PTHREADS
10:  0bb0c667ff =  9:  046008b4ef Clean up pthread_create() error handling
 -:  ---------- > 10:  2ad9554687 read-cache.c: initialize copy_len to shut up gcc 8
-- 
2.19.1.647.g708186aaf9
Previous: Duy NguyenNext: Nguyễn Thái Ngọc Duy
Message 32 of 66 in “Reduce #ifdef NO_PTHREADS”
  1. 00/10 Reduce #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  2. 01/10 thread-utils: macros to unconditionally compile pthreads APINguyễn Thái Ngọc Duy, Oct 27, 2018
  3. Jeff KingOct 27, 2018
  4. Duy NguyenOct 27, 2018
  5. Jeff KingOct 27, 2018
  6. Duy NguyenOct 27, 2018
  7. 03/10 name-hash.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  8. 04/10 attr.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  9. 05/10 send-pack.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  10. Jeff KingOct 27, 2018
  11. 06/10 grep: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  12. Jeff KingOct 27, 2018
  13. Junio C HamanoOct 29, 2018
  14. Jeff KingOct 29, 2018
  15. Duy NguyenOct 29, 2018
  16. Jeff KingOct 29, 2018
  17. Junio C HamanoOct 30, 2018
  18. 02/10 index-pack: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  19. Jeff KingOct 27, 2018
  20. 07/10 preload-index.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  21. Ben PeartOct 29, 2018
  22. 08/10 pack-objects: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  23. 09/10 read-cache.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  24. Ben PeartOct 29, 2018
  25. Duy NguyenOct 29, 2018
  26. Ben PeartOct 29, 2018
  27. Junio C HamanoOct 30, 2018
  28. 10/10 Clean up pthread_create() error handlingNguyễn Thái Ngọc Duy, Oct 27, 2018
  29. Jeff KingOct 27, 2018
  30. Jeff KingOct 27, 2018
  31. Duy NguyenOct 27, 2018
  32. 00/10 Reduce #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  33. 01/10 thread-utils: macros to unconditionally compile pthreads APINguyễn Thái Ngọc Duy, Oct 27, 2018
  34. 02/10 index-pack: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  35. 04/10 attr.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  36. 03/10 name-hash.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  37. 05/10 grep: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  38. 06/10 preload-index.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  39. Ben PeartOct 29, 2018
  40. Duy NguyenOct 29, 2018
  41. Ben PeartOct 29, 2018
  42. Jeff KingOct 29, 2018
  43. 07/10 pack-objects: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  44. 08/10 read-cache.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Oct 27, 2018
  45. Jeff KingOct 29, 2018
  46. Ben PeartOct 29, 2018
  47. Ben PeartOct 29, 2018
  48. 09/10 Clean up pthread_create() error handlingNguyễn Thái Ngọc Duy, Oct 27, 2018
  49. 10/10 read-cache.c: initialize copy_len to shut up gcc 8Nguyễn Thái Ngọc Duy, Oct 27, 2018
  50. Jeff KingOct 29, 2018
  51. 00/14 Reduce #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  52. 01/14 thread-utils: macros to unconditionally compile pthreads APINguyễn Thái Ngọc Duy, Nov 3, 2018
  53. 02/14 run-command.h: include thread-utils.h instead of pthread.hNguyễn Thái Ngọc Duy, Nov 3, 2018
  54. 03/14 send-pack.c: move async's #ifdef NO_PTHREADS back to run-command.cNguyễn Thái Ngọc Duy, Nov 3, 2018
  55. 04/14 index-pack: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  56. 05/14 name-hash.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  57. 06/14 attr.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  58. 07/14 grep: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  59. 09/14 preload-index.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  60. 08/14 grep: clean up num_threads handlingNguyễn Thái Ngọc Duy, Nov 3, 2018
  61. 10/14 pack-objects: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  62. 11/14 read-cache.c: remove #ifdef NO_PTHREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  63. 12/14 read-cache.c: reduce branching based on HAVE_THREADSNguyễn Thái Ngọc Duy, Nov 3, 2018
  64. 13/14 read-cache.c: initialize copy_len to shut up gcc 8Nguyễn Thái Ngọc Duy, Nov 3, 2018
  65. 14/14 Clean up pthread_create() error handlingNguyễn Thái Ngọc Duy, Nov 3, 2018
  66. Junio C HamanoNov 6, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.