JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.
If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.
If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.
| CodeSonar® 9.0p0 Hot Tips | CONFIDENTIAL | CodeSecure Inc |
ロックされている間にブロック関数が呼ばれています。
| クラス名 | Blocking in Critical Section | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| 日本語クラス名 | クリティカルセクション内でのブロック | |||||||||
| クラス分類 | 信頼性 (reliability) | |||||||||
| ニーモニック | CONCURRENCY.STARVE.BLOCKING | |||||||||
| カテゴリー |
|
|||||||||
| 対応言語 | C および C++ で利用可能です。 |
|||||||||
| 有効/無効設定 | このワーニングクラスのチェックはデフォルトで有効になっています。チェックを無効にするにはプロジェクト設定ファイル
(configuration file)に以下の WARNING_FILTER ルールを追加してください。
WARNING_FILTER += discard class="Blocking in Critical Section" |
ブロック関数が、一つもしくはそれ以上のロックが取得されている間に呼ばれた場合。
| ブロック関数とは | Any function treated as a blocking function by CodeSonar:
|
|---|---|
| ロックが取得されている間とは |
以下のいずれかでロックが取得され、そのロックがリリースされていない状態を指します。
|
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
void concurrency_starve_blocking(pthread_mutex_t lock){
sleep(2); /* ok: No lock held at this time */
if( pthread_mutex_lock(&lock) != 0 ){
abort();
}
sleep(3); /* 'Blocking in Critical Section' warning issued here
* - a lock is held while the thread blocks.
*/
if( pthread_mutex_unlock(&lock) != 0 ) abort();
sleep(4); /* ok: No lock held at this time */
}
設定ファイルの以下のパラメータがこのワーニングクラスのチェックに影響します。