diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-14 18:58:21 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-03-14 18:58:21 +0000 |
commit | 78cbcfd2a16c0cf3763173ce0a14d656bede0135 (patch) | |
tree | 5fd6d76721ba77adb12c7fc265befb5cf264329f /nuttx/fs | |
parent | 9daf318dc8fbefa6d41c739fa53baa155b31887f (diff) | |
download | px4-nuttx-78cbcfd2a16c0cf3763173ce0a14d656bede0135.tar.gz px4-nuttx-78cbcfd2a16c0cf3763173ce0a14d656bede0135.tar.bz2 px4-nuttx-78cbcfd2a16c0cf3763173ce0a14d656bede0135.zip |
Add 8052 IRQ test; Fix places where IDLE task could try to wait on semaphoresnuttx-1.1
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@61 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs')
-rw-r--r-- | nuttx/fs/fs_files.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/nuttx/fs/fs_files.c b/nuttx/fs/fs_files.c index 8d300b8ce..88f905ef4 100644 --- a/nuttx/fs/fs_files.c +++ b/nuttx/fs/fs_files.c @@ -122,11 +122,17 @@ int files_addreflist(FAR struct filelist *list) { if (list) { - /* Increment the reference count on the list */ + /* Increment the reference count on the list. + * NOTE: that we disable interrupts to do this + * (vs. taking the list semaphore). We do this + * because file cleanup operations often must be + * done from the IDLE task which cannot wait + * on semaphores. + */ - _files_semtake(list); + register irqstate_t flags = irqsave(); list->fl_crefs++; - _files_semgive(list); + irqrestore(flags); } return OK; } @@ -138,14 +144,22 @@ int files_releaselist(FAR struct filelist *list) int crefs; if (list) { - /* Decrement the reference count */ + /* Decrement the reference count on the list. + * NOTE: that we disable interrupts to do this + * (vs. taking the list semaphore). We do this + * because file cleanup operations often must be + * done from the IDLE task which cannot wait + * on semaphores. + */ - _files_semtake(list); + register irqstate_t flags = irqsave(); crefs = --(list->fl_crefs); - _files_semgive(list); + irqrestore(flags); /* If the count decrements to zero, then there is no reference - * to the structure and it should be deallocated. + * to the structure and it should be deallocated. Since there + * are references, it would be an error if any task still held + * a reference to the list's semaphore. */ if (crefs <= 0) |