From 16fa46443a132b46f893b62d6ae10d505a3a076e Mon Sep 17 00:00:00 2001 From: Ary Borenszweig <aborenszweig@manas.com.ar> Date: Mon, 18 Aug 2014 22:16:22 -0300 Subject: [PATCH] Moved some methods from c.cr to process.cr --- src/c.cr | 16 ---------------- src/process.cr | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/c.cr b/src/c.cr index 45861e4ff0..77252ee002 100644 --- a/src/c.cr +++ b/src/c.cr @@ -17,22 +17,6 @@ lib C fun realloc(ptr : Void*, size : UInt32) : Void* fun free(ptr : Void*) fun time(t : Int64) : Int64 - fun sleep(seconds : UInt32) : UInt32 fun free(ptr : Void*) fun memcmp(p1 : Void*, p2 : Void*, size : C::SizeT) : Int32 end - -def sleep(seconds) - if seconds < 0 - raise ArgumentError.new "sleep seconds must be positive" - end - C.sleep seconds.to_u32 -end - -def fork - Process.fork { yield } -end - -def fork() - Process.fork() -end diff --git a/src/process.cr b/src/process.cr index 761db67d0b..b78b4726ac 100644 --- a/src/process.cr +++ b/src/process.cr @@ -23,6 +23,8 @@ lib C fun times(buffer : Tms*) : ClockT fun sysconf(name : Int32) : Int64 + + fun sleep(seconds : UInt32) : UInt32 end module Process @@ -65,3 +67,18 @@ module Process Tms.new(tms.utime / hertz, tms.stime / hertz, tms.cutime / hertz, tms.cstime / hertz) end end + +def fork + Process.fork { yield } +end + +def fork() + Process.fork() +end + +def sleep(seconds) + if seconds < 0 + raise ArgumentError.new "sleep seconds must be positive" + end + C.sleep seconds.to_u32 +end -- GitLab