Commit 2b777c3
Improve libevent threading initialization order
Use static initializer to call evthread_use_pthreads() at program startup,
before any other code (including curl) can initialize libevent. This fixes
the "evthread initialization must be called BEFORE anything else!" error
on systems where curl is compiled with libevent support.
Changes:
- Remove event_enable_debug_mode() which can only be called once and
causes issues with shared libraries
- Use simple static initializer instead of constructor priority attribute
- evthread_use_pthreads() is safe to call multiple times1 parent 26d08fa commit 2b777c3
1 file changed
Lines changed: 23 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
91 | 105 | | |
92 | | - | |
93 | 106 | | |
94 | 107 | | |
95 | 108 | | |
| |||
0 commit comments