R/zzz.r

# nocov start
ENV <- new.env(parent = emptyenv())

.onLoad <- function (libname, pkgname) {
  
  ENV$semaphores = c()
  
  # Remove semaphores created with cleanup=TRUE
  finalizer <- function (e) {
    for (semaphore in e$semaphores)
      try(silent = TRUE, remove_semaphore(semaphore))
  }
  reg.finalizer(ENV, finalizer, onexit = TRUE)
  
}
# nocov end

Try the semaphore package in your browser

Any scripts or data that you put into this service are public.

semaphore documentation built on April 4, 2025, 4:14 a.m.