mFrame
載入中...
搜尋中...
無符合項目
ufm::lang::System 類別 參考文件final

系統核心入口 更多...

#include <System.h>

類別ufm::lang::System的繼承圖:
ufm::lang::NonInstantiable ufm::lang::Object ufm::lang::Interface

靜態公開方法(Static Public Methods)

static ufm::io::PrintStreamout (void)
 獲取系統輸出緩衝區
 
static ufm::lang::Readablein (void)
 獲取系統輸入緩衝區
 
static void reboot (void)
 重新啟動系統
 
static void setup (ufm::sys::SystemProvider &provider)
 系統初始化
 
static void start (void)
 啟動系統核心
 
static void error (const void *address, ufm::sys::ErrorCode code)
 拋出系統錯誤
 
static void throwError (const char *message, const char *path, ufm::sys::ErrorCode code)
 拋出錯誤並中斷執行
 
static uint32 getCoreSpeed (void)
 取得處理器核心運行頻率
 
static void lowerDelay (uint32 times)
 低階延遲
 
static bool delay (int milliseconds)
 延遲指定毫秒數
 
static void wait (void)
 無條件等待
 
static bool wait (int timeout)
 等待指定超時時間
 
static bool yield (void)
 主動讓渡 CPU 使他人執行
 
static int lock (void)
 鎖定系統資源
 
static int unlock (void)
 解鎖系統資源
 
static ufm::sys::ThreadcurrentThread (void)
 取得當前執行緒指標
 
static void execute (ufm::func::Runnable &runnable)
 執行 Runnable 任務
 
static ufm::sys::AllocatorgetAllocator (void)
 取得記憶體分配器
 
static uint32 microseconds (void)
 取得系統時間微秒數
 
static uint64 microseconds64 (void)
 取得系統時間微秒數
 
static uint32 seconds (void)
 取得系統時間秒數
 
static ufm::util::ApplicationgetAppMgr (void)
 取得應用程式管理器
 

靜態公開屬性

static ufm::sys::AllocatorvAllocator
 
static ufm::sys::KernelvKernel
 
static ufm::sys::HardwareInfovHardwareInfo
 

保護方法(Protected Methods)

virtual ~System (void) override=default
 Destroy the System object.
 
- 保護方法(Protected Methods) 繼承自 ufm::lang::NonInstantiable
 NonInstantiable (void)=delete
 禁止實例化 NonInstantiable 類別
 
 NonInstantiable (const NonInstantiable &)=delete
 禁止複製建構函式
 
virtual ~NonInstantiable (void) override=default
 Destroy the Non Instantiable object.
 
NonInstantiableoperator= (const NonInstantiable &)=delete
 
NonInstantiableoperator= (NonInstantiable &&)=delete
 

額外的繼承成員

- 公開方法(Public Methods) 繼承自 ufm::lang::Object
void * operator new (size_t n)
 使用運算子 new 分配記憶體
 
void * operator new (size_t n, void *p)
 在指定記憶體上調用運算子 new
 
virtual ufm::lang::ObjectgetObject (void) override
 取得對應的 Object 物件
 
void delay (int milliseconds) const
 延遲指定的毫秒數進行執行緒等待
 
bool equals (Object *object) const
 判斷與另一物件是否為相同參照(指標型態比較)
 
bool equals (Object &object) const
 判斷與另一物件是否為相同參照(參照型態比較)
 
void wait (void) const
 使當前線程等待直到被通知
 
bool wait (int timeout) const
 等待通知或超時
 
bool yield (void) const
 讓執行緒讓渡控制權給同優先權的下一個執行緒
 
int lock (void) const
 核心鎖定,鎖定期間禁止線程切換
 
int unlock (void) const
 核心解鎖
 
ufm::sys::ThreadcurrentThread (void) const
 取得當前執行緒指標
 
virtual int hashcode (void) const
 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
 
- 公開方法(Public Methods) 繼承自 ufm::lang::Interface
virtual ~Interface (void)=default
 虛擬析構函式
 

詳細描述

系統核心入口

System 類別作為系統與硬體之間的抽象層,提供以下靜態功能:

  • 系統啟動與初始化
  • 錯誤處理與拋出
  • 記憶體管理與分配
  • 執行緒控制與同步
  • 輸入輸出操作
  • 時間與延遲管理

確保應用程式能以一致、安全且高效的方式操作系統資源。

1.0.0

函式成員說明文件

◆ currentThread()

static ufm::sys::Thread * ufm::lang::System::currentThread ( void )
static

取得當前執行緒指標

傳回值
ufm::sys::Thread* 當前執行緒物件指標

◆ delay()

static bool ufm::lang::System::delay ( int milliseconds)
static

延遲指定毫秒數

將當前執行緒休眠至少指定的毫秒時間。

參數
milliseconds毫秒數
傳回值
bool 延遲是否成功

◆ error()

static void ufm::lang::System::error ( const void * address,
ufm::sys::ErrorCode code )
static

拋出系統錯誤

記錄錯誤來源與代碼,並使用 system_error 輸出錯誤資訊。

參數
address錯誤發生位置指標
code錯誤代碼

◆ execute()

static void ufm::lang::System::execute ( ufm::func::Runnable & runnable)
static

執行 Runnable 任務

將 Runnable 任務傳遞給系統排程器執行。

參數
runnable任務物件參考

◆ getAllocator()

static ufm::sys::Allocator * ufm::lang::System::getAllocator ( void )
inlinestatic

取得記憶體分配器

傳回值
ufm::sys::Allocator& 記憶體分配器

◆ getAppMgr()

static ufm::util::Application & ufm::lang::System::getAppMgr ( void )
inlinestatic

取得應用程式管理器

獲取系統的應用程式管理器實例,用於管理和調度應用程式。 此方法提供對應用程式管理器的存取,便於進行應用程式的增刪改查等操作。

傳回值
ufm::util::ApplicationManager& 應用程式管理器實例

◆ getCoreSpeed()

static uint32 ufm::lang::System::getCoreSpeed ( void )
static

取得處理器核心運行頻率

傳回值
uint32 時脈頻率 (Hz)

◆ in()

static ufm::lang::Readable & ufm::lang::System::in ( void )
inlinestatic

獲取系統輸入緩衝區

回傳可用於讀取字元或資料的 Readable 物件引用。

傳回值
ufm::lang::Readable& 系統輸入流

◆ lock()

static int ufm::lang::System::lock ( void )
static

鎖定系統資源

進入臨界區,防止中斷或多執行緒同時訪問。

傳回值
int 鎖定狀態

◆ lowerDelay()

static void ufm::lang::System::lowerDelay ( uint32 times)
static

低階延遲

根據指定的 CPU 時脈周期進行微秒級延遲。

參數
times延遲次數 (CPU 週期)

◆ microseconds()

static uint32 ufm::lang::System::microseconds ( void )
inlinestatic

取得系統時間微秒數

獲取系統自啟動以來的總運行時間,單位為微秒。 此方法通常用於計時和性能測量。

傳回值
uint32 系統運行時間,單位為微秒

◆ microseconds64()

static uint64 ufm::lang::System::microseconds64 ( void )
inlinestatic

取得系統時間微秒數

獲取系統自啟動以來的總運行時間,單位為微秒。 此方法通常用於計時和性能測量。

傳回值
uint64 系統運行時間,單位為微秒

◆ out()

static ufm::io::PrintStream & ufm::lang::System::out ( void )
inlinestatic

獲取系統輸出緩衝區

回傳可用於輸出字串或資料的 PrintStream 物件引用。

傳回值
ufm::io::PrintStream& 系統輸出流

◆ reboot()

static void ufm::lang::System::reboot ( void )
static

重新啟動系統

執行系統重啟流程,將所有資源釋放並重置硬體。

◆ seconds()

static uint32 ufm::lang::System::seconds ( void )
inlinestatic

取得系統時間秒數

獲取系統自啟動以來的總運行時間,單位為秒。 此方法通常用於計時和性能測量。

傳回值
uint32 系統運行時間,單位為秒

◆ setup()

static void ufm::lang::System::setup ( ufm::sys::SystemProvider & provider)
static

系統初始化

使用提供者設定系統參數並啟動底層服務。

參數
provider系統設定與提供者介面

◆ start()

static void ufm::lang::System::start ( void )
static

啟動系統核心

呼叫 Kernel 的啟動流程,正式進入多任務運行階段。

◆ throwError()

static void ufm::lang::System::throwError ( const char * message,
const char * path,
ufm::sys::ErrorCode code )
static

拋出錯誤並中斷執行

顯示錯誤訊息與路徑,並根據錯誤代碼做相應處理。

參數
message錯誤描述
path發生位置 (檔案或函式名稱)
code錯誤代碼

◆ unlock()

static int ufm::lang::System::unlock ( void )
static

解鎖系統資源

離開臨界區,允許其他執行緒或中斷訪問。

傳回值
int 解鎖狀態

◆ wait() [1/2]

static bool ufm::lang::System::wait ( int timeout)
static

等待指定超時時間

如果在超時前被喚醒返回 true,否則返回 false。

參數
timeout超時時間 (毫秒)
傳回值
bool 是否在超時前被喚醒

◆ wait() [2/2]

static void ufm::lang::System::wait ( void )
static

無條件等待

將當前執行緒進入等待狀態,直到外部事件喚醒。

◆ yield()

static bool ufm::lang::System::yield ( void )
static

主動讓渡 CPU 使他人執行

傳回值
bool 是否成功讓渡 CPU

此類別(class) 文件是由下列檔案中產生: