summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorHanhui <sylixos@gmail.com>2019-04-25 09:22:31 (GMT)
committer Hanhui <sylixos@gmail.com>2019-04-18 15:49:33 (GMT)
commit22f71dd69255a87462e317f0b349c12b04d9aa38 (patch)
treef736d873a5f869cecb01ba9e8ed2c965f4809926
parenteaed3abbc627f342c1141bd2d9d80ece7d60d0c8 (diff)
downloadAIC-OS-22f71dd69255a87462e317f0b349c12b04d9aa38.zip
Fixed disk cache remove deadlock error.
-rw-r--r--SylixOS/fs/diskCache/diskCache.c6
-rw-r--r--SylixOS/system/signal/signalLib.c2
2 files changed, 6 insertions, 2 deletions
diff --git a/SylixOS/fs/diskCache/diskCache.c b/SylixOS/fs/diskCache/diskCache.c
index 7d70e17..a46ae01 100644
--- a/SylixOS/fs/diskCache/diskCache.c
+++ b/SylixOS/fs/diskCache/diskCache.c
@@ -464,6 +464,8 @@ ULONG API_DiskCacheCreate (PLW_BLK_DEV pblkdDisk,
diskCacheDelete(pblkdCfCache);
cfDiskCreate(pblkdCf);
+** 注 意 : 必须先 ListDel 在 DISKCACHE_LOCK 防止死锁.
+
API 函数
*********************************************************************************************************/
LW_API
@@ -472,11 +474,11 @@ INT API_DiskCacheDelete (PLW_BLK_DEV pblkdDiskCache)
REGISTER PLW_DISKCACHE_CB pdiskcDiskCache = (PLW_DISKCACHE_CB)pblkdDiskCache;
if (pblkdDiskCache) {
+ __diskCacheListDel(pdiskcDiskCache); /* 退出背景线程 */
+
__LW_DISKCACHE_LOCK(pdiskcDiskCache); /* 等待使用权 */
-
__diskCacheWpSync(&pdiskcDiskCache->DISKC_wpWrite);
__diskCacheWpDelete(&pdiskcDiskCache->DISKC_wpWrite);
- __diskCacheListDel(pdiskcDiskCache); /* 退出背景线程 */
API_SemaphoreMDelete(&pdiskcDiskCache->DISKC_hDiskCacheLock);
__SHEAP_FREE(pdiskcDiskCache->DISKC_pcCacheNodeMem);
diff --git a/SylixOS/system/signal/signalLib.c b/SylixOS/system/signal/signalLib.c
index 1e010fb..38d4d3e 100644
--- a/SylixOS/system/signal/signalLib.c
+++ b/SylixOS/system/signal/signalLib.c
@@ -170,11 +170,13 @@ static VOID __signalExitHandle (PLW_CLASS_TCB ptcbCur, INT iSigNo, struct sig
#endif /* LW_CFG_MODULELOADER_EN > 0 */
_exit(psiginfo->si_int);
+#if LW_CFG_MODULELOADER_EN > 0
} else if (iSigNo != SIGTERM) { /* 仅删除当前线程 */
if (pid > 0 && vprocIsMainThread()) {
vprocExitModeSet(pid, LW_VPROC_EXIT_FORCE); /* 强制进程退出 */
vprocSetImmediatelyTerm(pid); /* 立即退出模式 */
}
+#endif /* LW_CFG_MODULELOADER_EN > 0 */
}
/* 删除自己 */
API_ThreadDelete(&ulId, (PVOID)psiginfo->si_int); /* 如果在安全模式, 则退出安全 */