Changeset 52e4f52 in mainline
- Timestamp:
- 2009-06-23T18:19:56Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d4b9d28
- Parents:
- ed990cf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/bd/rd/rd.c
red990cf r52e4f52 51 51 #include <align.h> 52 52 #include <async.h> 53 #include <f utex.h>53 #include <fibril_sync.h> 54 54 #include <stdio.h> 55 55 #include <devmap.h> … … 64 64 65 65 /** 66 * This futexprotects the ramdisk's data.66 * This rwlock protects the ramdisk's data. 67 67 * If we were to serve multiple requests (read + write or several writes) 68 68 * concurrently (i.e. from two or more threads), each read and write needs to be 69 * protected by this futex.69 * protected by this rwlock. 70 70 */ 71 atomic_t rd_futex = FUTEX_INITIALIZER;71 fibril_rwlock_t rd_lock; 72 72 73 73 /** Handle one connection to ramdisk. … … 140 140 break; 141 141 } 142 f utex_down(&rd_futex);142 fibril_rwlock_read_lock(&rd_lock); 143 143 memcpy(fs_va, rd_addr + offset * block_size, block_size); 144 f utex_up(&rd_futex);144 fibril_rwlock_read_unlock(&rd_lock); 145 145 retval = EOK; 146 146 break; … … 162 162 break; 163 163 } 164 f utex_up(&rd_futex);164 fibril_rwlock_write_lock(&rd_lock); 165 165 memcpy(rd_addr + offset * block_size, fs_va, block_size); 166 f utex_down(&rd_futex);166 fibril_rwlock_write_unlock(&rd_lock); 167 167 retval = EOK; 168 168 break; … … 217 217 return false; 218 218 } 219 220 fibril_rwlock_initialize(&rd_lock); 219 221 220 222 return true;
Note:
See TracChangeset
for help on using the changeset viewer.