mFrame
載入中...
搜尋中...
無符合項目
mframe::lang::System 類別 參考文件final
類別mframe::lang::System的繼承圖:
mframe::lang::Object mframe::lang::Interface

靜態公開方法(Static Public Methods)

static mframe::io::PrintBufferout (void)
 
static mframe::lang::Readablein (void)
 
static void reboot (void)
 設備重新啟動
 
static void setup (mframe::sys::SystemConfig &systemConfig)
 
static void start (mframe::func::Runnable &task, int stackSize)
 系統初始化核心
 
static void error (const void *address, mframe::sys::ErrorCode code)
 錯誤拋出
 
static void throwError (const char *message, const char *path, mframe::sys::ErrorCode code)
 拋出錯誤
 
static int getCoreClock (void)
 Get the Core Clock object.
 
static void lowerDelay (uint32 times)
 
static bool delay (int milliseconds)
 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
 
static void wait (void)
 導致當前線程等待,直到另一個線程調用此對象的 notify()方法或 notifyAll()方法,或其他一些線 程中斷當前線程,或一定量的實時時間。
 
static bool wait (int timeout)
 導致當前線程等待,直到另一個線程調用此對象的notify()方法或notifyAll()方法,或指定的時間已 過。
 
static bool yield (void)
 函數yield()將控制權傳遞給處於READY狀態且具有相同優先級的下一個線程。 如果在READY狀態下沒有其他優先級相同的線程,則當前線程繼續執行,不會發生線程切換。
 
static int lock (void)
 核心鎖定,在調用systemUnlock以前將不會進行執行緒切換
 
static int unlock (void)
 
static mframe::sys::ThreadcurrentThread (void)
 取得當前的執行緒
 
static void execute (mframe::func::Runnable &runnable)
 
static mframe::sys::ThreadallocThread (mframe::func::Runnable &runnable, int stackSize)
 
static mframe::sys::ThreadallocThread (mframe::func::Runnable &runnable, mframe::lang::Data &stackMemory)
 
static mframe::sys::AllocatorgetAllocator (void)
 Get the Allocator object.
 
static mframe::sys::SystemControlgetControl (void)
 取得系統層控制項目。
 

靜態公開屬性

static mframe::sys::SvchostmSvchost
 
static mframe::sys::AllocatormAllocator
 
static mframe::sys::KernelmKernel
 
static mframe::sys::HardwareInfomHardwareInfo
 

額外的繼承成員

- 公開方法(Public Methods) 繼承自 mframe::lang::Object
 Object (void)
 Construct a new Object object.
 
virtual ~Object (void) override
 Destroy the Object object.
 
void * operator new (size_t n)
 
void * operator new (size_t n, void *p)
 
mframe::lang::ObjectgetObject (void) override
 取得類Object
 
void delay (int milliseconds) const
 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
 
bool equals (Object *object) const
 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
 
bool equals (Object &object) const
 函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。
 
void wait (void) const
 導致當前線程等待,直到另一個線程調用此對象的notify()方法或notifyAll()方法,或指定的時間 已過。
 
bool wait (int timeout) const
 導致當前線程等待,直到另一個線程調用此對象的 notify()方法或 notifyAll()方法,或其他一些線 程中斷當前線程,或一定量的實時時間。
 
bool yield (void) const
 函數yield()將控制權傳遞給處於READY狀態且具有相同優先級的下一個線程。 如果在READY狀態下沒有其他優先級相同的線程,則當前線程繼續執行,不會發生線程切換。
 
int lock (void) const
 核心鎖定,在調用unlock以前將不會進行執行緒切換
 
int unlock (void) const
 核心解鎖。
 
mframe::sys::ThreadcurrentThread (void) const
 取得當前的執行緒
 
virtual int hashcode (void) const
 返回對象的哈希碼值。支持這種方法是為了散列表,如HashMap提供的那樣。
 
- 公開方法(Public Methods) 繼承自 mframe::lang::Interface
virtual ~Interface (void)=default
 Destroy the struct object.
 

函式成員說明文件

◆ allocThread() [1/2]

static mframe::sys::Thread & mframe::lang::System::allocThread ( mframe::func::Runnable & runnable,
int stackSize )
static
參數
runnable
stackSize
傳回值
mframe::sys::Thread&

◆ allocThread() [2/2]

static mframe::sys::Thread & mframe::lang::System::allocThread ( mframe::func::Runnable & runnable,
mframe::lang::Data & stackMemory )
static
參數
runnable
stackMemory
傳回值
mframe::sys::Thread&

◆ currentThread()

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

取得當前的執行緒

傳回值
null 執行緒取得失敗,可能正在執行中斷事件或是系統並未啟動
Thread 當前執行緒

◆ delay()

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

函數 delay 等待內核滴答中指定的時間段。 對於1的值,系統等待直到下一個計時器滴答發生。 實際時間延遲最多可能比指定時間少一個計時器滴答聲,即在下一個系統滴答聲發生之前立即調用 osDelay(1),線程會立即重新安排。

參數
milliseconds- time ticks value

◆ error()

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

錯誤拋出

參數
address
code

◆ execute()

static void mframe::lang::System::execute ( mframe::func::Runnable & runnable)
static
參數
runnable
傳回值
true
false

◆ getAllocator()

static mframe::sys::Allocator * mframe::lang::System::getAllocator ( void )
static

Get the Allocator object.

傳回值
mframe::sys::Allocator&

◆ getControl()

static mframe::sys::SystemControl & mframe::lang::System::getControl ( void )
static

取得系統層控制項目。

傳回值
mframe::sys::SystemControl& 控制項

◆ getCoreClock()

static int mframe::lang::System::getCoreClock ( void )
static

Get the Core Clock object.

傳回值
uint32

◆ in()

static mframe::lang::Readable & mframe::lang::System::in ( void )
static

◆ lock()

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

核心鎖定,在調用systemUnlock以前將不會進行執行緒切換

傳回值
int lock調用層數

◆ lowerDelay()

static void mframe::lang::System::lowerDelay ( uint32 times)
static
參數
times

◆ out()

static mframe::io::PrintBuffer & mframe::lang::System::out ( void )
static

◆ setup()

static void mframe::lang::System::setup ( mframe::sys::SystemConfig & systemConfig)
static
參數
systemConfig

◆ start()

static void mframe::lang::System::start ( mframe::func::Runnable & task,
int stackSize )
static

系統初始化核心

參數
kernel核心方法,建議使用CMSIS-RTOS2

◆ throwError()

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

拋出錯誤

參數
message錯誤訊息
path方法路徑
code異常碼

◆ unlock()

static int mframe::lang::System::unlock ( void )
static
傳回值
int lock調用剩餘層數,當值為0時核心解鎖,開始執行緒切換

◆ wait() [1/2]

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

導致當前線程等待,直到另一個線程調用此對象的notify()方法或notifyAll()方法,或指定的時間已 過。

當前的線程必須擁有該對象的顯示器。

此方法使當前線程(稱為T )將其放置在該對象的等待集中,然後放棄對該對象的任何和所有同步聲明。 線程T變得禁用線程調度目的,並且休眠,直到發生四件事情之一:

  • 一些其他線程調用該對象的notify方法,並且線程T恰好被任意選擇為被喚醒的線程。
  • 某些其他線程調用此對象的notifyAll方法。
  • 一些其他線程interrupts線程T。

然後從該對象的等待集中刪除線程T ,並重新啟用線程調度。然後它以通常的方式與其他線程競爭在對像 上進行同步的權限; 一旦獲得了對象的控制,其對對象的所有同步聲明就恢復到現狀 - 也就是在調用wait方法之後的情況。 線程T然後從調用wait方法返回。因此,從返回wait方法,對象和線程的同步狀態T正是因為它是當wait 被調用的方法。

線程也可以喚醒,而不會被通知,中斷或超時,即所謂的虛假喚醒 。雖然這在實踐中很少會發生, 但應用程序必須通過測試應該使線程被喚醒的條件來防範,並且如果條件不滿足則繼續等待。 換句話說,等待應該總是出現在循環中,就像這樣:

while(<condition does not hold>){
this->wait();
... // Perform action appropriate to condition
}
static void wait(void)
導致當前線程等待,直到另一個線程調用此對象的 notify()方法或 notifyAll()方法,或其他一些線 程中斷當前線程,或一定量的實時時間。
傳回值
true:
  • 執行含式成功並且已被notify
false:
  • 無法在中斷時被呼叫。

◆ wait() [2/2]

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

導致當前線程等待,直到另一個線程調用此對象的 notify()方法或 notifyAll()方法,或其他一些線 程中斷當前線程,或一定量的實時時間。

這種方法類似於一個參數的 wait方法,但它允許對放棄之前等待通知的時間進行更精細的控制。 以納秒 為單位的實時數量由下式給出:

1000000*超時+納米

在所有其他方面,該方法與一個參數的方法 wait(long)相同。 特別是, wait(0, 0)意味著同樣的事 情 wait(0) 。

當前的線程必須擁有該對象的顯示器。 線程釋放此監視器的所有權,並等待直到發生以下兩種情況之一:

  • 另一個線程通知等待該對象的監視器的線程通過調用 notify方法或 notifyAll方法來喚醒。
  • timeout毫秒加 nanos納秒參數指定的超時時間已過。

然後線程等待,直到它可以重新獲得監視器的所有權並恢復執行。

像在一個參數版本中,中斷和虛假喚醒是可能的,並且該方法應該始終在循環中使用:

while(<condition does not hold>){
this->wait(timeout);
... // Perform action appropriate to condition
}
參數
timeout- 以毫秒為單位等待的最長時間。
傳回值
true
  • 執行含式成功並且已被notify
  • 已經到達timeout時間
false
  • 如果超時值為負值或是值不在0-999999範圍內。
  • 無法在中斷時被呼叫。

◆ yield()

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

函數yield()將控制權傳遞給處於READY狀態且具有相同優先級的下一個線程。 如果在READY狀態下沒有其他優先級相同的線程,則當前線程繼續執行,不會發生線程切換。

函數yield()不會將線程設置為BLOCKED狀態。 因此,即使處於READY狀態的線程可用,也不會調度優先 級較低的線程。

傳回值
true
  • 成功發生線程切換
false
  • 無發生現程切換,可能無相同優先級需求
  • 無法在中斷時被呼叫。

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