diff options
| author | panicbit <[email protected]> | 2017-07-11 03:21:47 +0200 |
|---|---|---|
| committer | panicbit <[email protected]> | 2017-07-11 03:21:47 +0200 |
| commit | 393ef5f8a9ad90cc7705f5900e70cd35fee9599d (patch) | |
| tree | 4fe3c3ec2c236a2c80537e7ebc5ae6a49df16775 /ctr-std/src | |
| parent | Remove ctr-libc dep from ctr-std (diff) | |
| parent | Merge pull request #31 from FenrirWolf/ctrulib-update (diff) | |
| download | ctru-rs-393ef5f8a9ad90cc7705f5900e70cd35fee9599d.tar.xz ctru-rs-393ef5f8a9ad90cc7705f5900e70cd35fee9599d.zip | |
Merge branch 'master' into nightly_update
Diffstat (limited to 'ctr-std/src')
| -rw-r--r-- | ctr-std/src/panicking.rs | 6 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/condvar.rs | 4 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/mutex.rs | 24 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/rand.rs | 2 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/thread.rs | 8 | ||||
| -rw-r--r-- | ctr-std/src/sys/unix/time.rs | 2 |
6 files changed, 22 insertions, 24 deletions
diff --git a/ctr-std/src/panicking.rs b/ctr-std/src/panicking.rs index efb828a..0de44be 100644 --- a/ctr-std/src/panicking.rs +++ b/ctr-std/src/panicking.rs @@ -63,8 +63,8 @@ pub fn begin_panic<M: Any + Send + Display>(msg: M, file_line: &(&'static str, u let msg = Box::new(msg); let (file, line) = *file_line; - use libctru::console::consoleInit; - use libctru::gfx::gfxScreen_t; + use libctru::consoleInit; + use libctru::gfxScreen_t; // set up a new console, overwriting whatever was on the top screen // before we started panicking @@ -74,7 +74,7 @@ pub fn begin_panic<M: Any + Send + Display>(msg: M, file_line: &(&'static str, u println!(" {}", msg); // Terminate the process to ensure that all threads cease when panicking. - unsafe { ::libctru::svc::svcExitProcess() } + unsafe { ::libctru::svcExitProcess() } // On 3DS hardware, code execution will have terminated at the above function. // diff --git a/ctr-std/src/sys/unix/condvar.rs b/ctr-std/src/sys/unix/condvar.rs index 51ff665..b32298c 100644 --- a/ctr-std/src/sys/unix/condvar.rs +++ b/ctr-std/src/sys/unix/condvar.rs @@ -17,8 +17,8 @@ use time::Duration; use sys::mutex::{self, Mutex}; -use libctru::synchronization::{__sync_get_arbiter, LightLock}; -use libctru::svc::{svcArbitrateAddress, ArbitrationType}; +use libctru::{__sync_get_arbiter, LightLock}; +use libctru::{svcArbitrateAddress, ArbitrationType}; pub struct Condvar { lock: UnsafeCell<*mut LightLock>, diff --git a/ctr-std/src/sys/unix/mutex.rs b/ctr-std/src/sys/unix/mutex.rs index d4fd2c2..0cfd392 100644 --- a/ctr-std/src/sys/unix/mutex.rs +++ b/ctr-std/src/sys/unix/mutex.rs @@ -11,12 +11,10 @@ use cell::UnsafeCell; use mem; -use libctru::synchronization; - -pub struct Mutex { inner: UnsafeCell<synchronization::LightLock> } +pub struct Mutex { inner: UnsafeCell<::libctru::LightLock> } #[inline] -pub unsafe fn raw(m: &Mutex) -> *mut synchronization::LightLock { +pub unsafe fn raw(m: &Mutex) -> *mut ::libctru::LightLock { m.inner.get() } @@ -30,19 +28,19 @@ impl Mutex { } #[inline] pub unsafe fn init(&mut self) { - synchronization::LightLock_Init(self.inner.get()); + ::libctru::LightLock_Init(self.inner.get()); } #[inline] pub unsafe fn lock(&self) { - synchronization::LightLock_Lock(self.inner.get()); + ::libctru::LightLock_Lock(self.inner.get()); } #[inline] pub unsafe fn unlock(&self) { - synchronization::LightLock_Unlock(self.inner.get()); + ::libctru::LightLock_Unlock(self.inner.get()); } #[inline] pub unsafe fn try_lock(&self) -> bool { - match synchronization::LightLock_TryLock(self.inner.get()) { + match ::libctru::LightLock_TryLock(self.inner.get()) { 0 => true, _ => false, } @@ -51,7 +49,7 @@ impl Mutex { pub unsafe fn destroy(&self) {} } -pub struct ReentrantMutex { inner: UnsafeCell<synchronization::RecursiveLock> } +pub struct ReentrantMutex { inner: UnsafeCell<::libctru::RecursiveLock> } unsafe impl Send for ReentrantMutex {} unsafe impl Sync for ReentrantMutex {} @@ -62,19 +60,19 @@ impl ReentrantMutex { } #[inline] pub unsafe fn init(&mut self) { - synchronization::RecursiveLock_Init(self.inner.get()); + ::libctru::RecursiveLock_Init(self.inner.get()); } #[inline] pub unsafe fn lock(&self) { - synchronization::RecursiveLock_Lock(self.inner.get()); + ::libctru::RecursiveLock_Lock(self.inner.get()); } #[inline] pub unsafe fn unlock(&self) { - synchronization::RecursiveLock_Unlock(self.inner.get()); + ::libctru::RecursiveLock_Unlock(self.inner.get()); } #[inline] pub unsafe fn try_lock(&self) -> bool { - match synchronization::RecursiveLock_TryLock(self.inner.get()) { + match ::libctru::RecursiveLock_TryLock(self.inner.get()) { 0 => true, _ => false, } diff --git a/ctr-std/src/sys/unix/rand.rs b/ctr-std/src/sys/unix/rand.rs index 7fdc166..39c967a 100644 --- a/ctr-std/src/sys/unix/rand.rs +++ b/ctr-std/src/sys/unix/rand.rs @@ -12,7 +12,7 @@ use io::{self, Error, ErrorKind}; use mem; use rand::Rng; -use libctru::services::sslc::{sslcInit, sslcExit, sslcGenerateRandomData}; +use libctru::{sslcInit, sslcExit, sslcGenerateRandomData}; pub struct OsRng(()); diff --git a/ctr-std/src/sys/unix/thread.rs b/ctr-std/src/sys/unix/thread.rs index 572ac72..a7178a3 100644 --- a/ctr-std/src/sys/unix/thread.rs +++ b/ctr-std/src/sys/unix/thread.rs @@ -18,9 +18,9 @@ use ptr; use sys_common::thread::start_thread; use time::Duration; -use libctru::svc::{svcSleepThread, svcGetThreadPriority}; -use libctru::thread::{threadCreate, threadJoin, threadFree}; -use libctru::thread::Thread as ThreadHandle; +use libctru::{svcSleepThread, svcGetThreadPriority}; +use libctru::{threadCreate, threadJoin, threadFree}; +use libctru::Thread as ThreadHandle; pub struct Thread { handle: ThreadHandle, @@ -44,7 +44,7 @@ impl Thread { priority -= 1; let handle = threadCreate(Some(thread_func), &*p as *const _ as *mut _, - stack_size, priority, -2, 0); + stack_size, priority, -2, false); return if handle == ptr::null_mut() { Err(io::Error::from_raw_os_error(libc::EAGAIN)) diff --git a/ctr-std/src/sys/unix/time.rs b/ctr-std/src/sys/unix/time.rs index e8c0632..3bc1dca 100644 --- a/ctr-std/src/sys/unix/time.rs +++ b/ctr-std/src/sys/unix/time.rs @@ -192,7 +192,7 @@ mod inner { // Gets the current system tick #[inline] fn get_system_tick() -> u64 { - unsafe { libctru::svc::svcGetSystemTick() } + unsafe { libctru::svcGetSystemTick() } } // A struct representing the clock speed of the 3DS |