2012-07-27 257 views

回答

2

沒有內置API來刷新消息隊列中的所有消息。
如果你想要做的是從隊列中丟棄的所有消息,這裏是一個快速的方法來做到這一點:

void discardQMessages(MSG_Q_ID id) { 
    while(
     msgQReceive(id, NULL, 0, NO_WAIT) != ERROR 
     ) ; 

    if {errno != S_objLib_OBJ_UNAVAILABLE) 
    /* Uh oh... got some problem */ 
} 

那麼當您從任何OS API調用收到錯誤總是檢查errno。

+0

thnx您的信息。我也只是以這種方式思考。 – Pratik 2012-07-30 03:03:50