set_cpu_offline Subroutine

private impure elemental subroutine set_cpu_offline(this)

Type Bound

linux_cpu

Arguments

Type IntentOptional Attributes Name
class(linux_cpu), intent(inout) :: this

Contents

Source Code


Source Code

   elemental impure subroutine set_cpu_offline(this)
      class(linux_cpu), intent(inout) :: this
      integer                         :: nunit, stat
      logical                         :: ex
      character(len=:), allocatable   :: file_name

      this%online = 0

      file_name = this%path_cpu//"/online"
      inquire(file=file_name, exist=ex)
      if (ex) then
         open(newunit=nunit, file=file_name, iostat=stat)
         write(nunit, '(i0)') this%online
         close(nunit)
      else
         ! error stop "file not found: "//file_name
      endif
   end subroutine set_cpu_offline