diff options
Diffstat (limited to 'src/comp.c')
| -rw-r--r-- | src/comp.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/comp.c b/src/comp.c index bd7ecfffc23..3cc5506f989 100644 --- a/src/comp.c +++ b/src/comp.c | |||
| @@ -40,6 +40,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */ | |||
| 40 | #include "md5.h" | 40 | #include "md5.h" |
| 41 | #include "sysstdio.h" | 41 | #include "sysstdio.h" |
| 42 | #include "zlib.h" | 42 | #include "zlib.h" |
| 43 | #include "atimer.h" | ||
| 43 | 44 | ||
| 44 | 45 | ||
| 45 | /********************************/ | 46 | /********************************/ |
| @@ -5296,10 +5297,29 @@ unset_cu_load_ongoing (Lisp_Object comp_u) | |||
| 5296 | XNATIVE_COMP_UNIT (comp_u)->load_ongoing = false; | 5297 | XNATIVE_COMP_UNIT (comp_u)->load_ongoing = false; |
| 5297 | } | 5298 | } |
| 5298 | 5299 | ||
| 5300 | /* Number of native loads going on. */ | ||
| 5301 | unsigned loads; | ||
| 5302 | |||
| 5303 | sigset_t oldset; | ||
| 5304 | |||
| 5305 | static void | ||
| 5306 | maybe_unblock_atimers (Lisp_Object obj) | ||
| 5307 | { | ||
| 5308 | --loads; | ||
| 5309 | if (!loads) | ||
| 5310 | unblock_atimers (&oldset); | ||
| 5311 | } | ||
| 5312 | |||
| 5299 | Lisp_Object | 5313 | Lisp_Object |
| 5300 | load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | 5314 | load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, |
| 5301 | bool late_load) | 5315 | bool late_load) |
| 5302 | { | 5316 | { |
| 5317 | specpdl_ref count = SPECPDL_INDEX (); | ||
| 5318 | if (!loads) | ||
| 5319 | block_atimers (&oldset); | ||
| 5320 | ++loads; | ||
| 5321 | record_unwind_protect (maybe_unblock_atimers, Qnil); | ||
| 5322 | |||
| 5303 | Lisp_Object res = Qnil; | 5323 | Lisp_Object res = Qnil; |
| 5304 | dynlib_handle_ptr handle = comp_u->handle; | 5324 | dynlib_handle_ptr handle = comp_u->handle; |
| 5305 | Lisp_Object comp_u_lisp_obj; | 5325 | Lisp_Object comp_u_lisp_obj; |
| @@ -5336,7 +5356,6 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5336 | identify is we have at least another load active on it. */ | 5356 | identify is we have at least another load active on it. */ |
| 5337 | bool recursive_load = comp_u->load_ongoing; | 5357 | bool recursive_load = comp_u->load_ongoing; |
| 5338 | comp_u->load_ongoing = true; | 5358 | comp_u->load_ongoing = true; |
| 5339 | specpdl_ref count = SPECPDL_INDEX (); | ||
| 5340 | if (!recursive_load) | 5359 | if (!recursive_load) |
| 5341 | record_unwind_protect (unset_cu_load_ongoing, comp_u_lisp_obj); | 5360 | record_unwind_protect (unset_cu_load_ongoing, comp_u_lisp_obj); |
| 5342 | 5361 | ||
| @@ -5437,9 +5456,7 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump, | |||
| 5437 | eassert (check_comp_unit_relocs (comp_u)); | 5456 | eassert (check_comp_unit_relocs (comp_u)); |
| 5438 | } | 5457 | } |
| 5439 | 5458 | ||
| 5440 | if (!recursive_load) | 5459 | unbind_to (count, Qnil); |
| 5441 | /* Clean-up the load ongoing flag in case. */ | ||
| 5442 | unbind_to (count, Qnil); | ||
| 5443 | 5460 | ||
| 5444 | register_native_comp_unit (comp_u_lisp_obj); | 5461 | register_native_comp_unit (comp_u_lisp_obj); |
| 5445 | 5462 | ||