Skip to content

Commit

Permalink
don't cancel tick thread in Windows on Arm
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinushey committed Aug 23, 2022
1 parent f615c9a commit ab360db
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# cli (development version)

* Fixed an issue where the R session could crash on exit when loading cli
when running with Windows on Arm. (#494; @kevinushey)

* Vectors are truncated at 20 elements now by default, instead of 100 (#430).

* 20 new spinners from the awesome
Expand Down
1 change: 0 additions & 1 deletion cli.Rproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,5 @@ LineEndingConversion: Posix

BuildType: Package
PackageUseDevtools: Yes
PackageCleanBeforeInstall: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageRoxygenize: rd,collate,namespace
15 changes: 15 additions & 0 deletions src/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,22 @@ SEXP clic_start_thread(SEXP pkg, SEXP ticktime, SEXP speedtime) {
}

int cli__kill_thread() {

int ret = 0;

#ifdef _WIN32

// On ARM64 builds of Windows (when running through x86 emulation),
// cancelling the running tick thread seems to cause issues during
// process shutdown. Avoid the issue by just neglecting to cancel
// the thread altogether.
const char* arch = getenv("PROCESSOR_ARCHITECTURE");
if (!strcmp(arch, "ARM64")) {
return 0;
}

#endif

/* This should not happen, but be extra careful */
if (tick_thread) {
ret = pthread_cancel(tick_thread);
Expand Down

0 comments on commit ab360db

Please sign in to comment.