Changeset ae03552e in mainline
- Timestamp:
- 2017-10-07T16:39:45Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a0be5d0
- Parents:
- e9e24f2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/hcd.c
re9e24f2 rae03552e 248 248 249 249 typedef struct { 250 volatile unsigned done; 250 fibril_mutex_t done_mtx; 251 fibril_condvar_t done_cv; 252 unsigned done; 251 253 int ret; 252 254 size_t size; … … 258 260 assert(d); 259 261 d->ret = ret; 262 d->size = size; 263 fibril_mutex_lock(&d->done_mtx); 260 264 d->done = 1; 261 d->size = size; 265 fibril_condvar_broadcast(&d->done_cv); 266 fibril_mutex_unlock(&d->done_mtx); 262 267 } 263 268 … … 267 272 assert(data); 268 273 d->ret = ret; 274 fibril_mutex_lock(&d->done_mtx); 269 275 d->done = 1; 276 fibril_condvar_broadcast(&d->done_cv); 277 fibril_mutex_unlock(&d->done_mtx); 270 278 } 271 279 … … 277 285 assert(hcd); 278 286 sync_data_t sd = { .done = 0, .ret = EBUSY, .size = size }; 287 fibril_mutex_initialize(&sd.done_mtx); 288 fibril_condvar_initialize(&sd.done_cv); 279 289 280 290 const int ret = hcd_send_batch(hcd, target, dir, data, size, setup_data, … … 284 294 return ret; 285 295 286 while (!sd.done) { 287 async_usleep(1000); 288 } 296 fibril_mutex_lock(&sd.done_mtx); 297 while (!sd.done) 298 fibril_condvar_wait(&sd.done_cv, &sd.done_mtx); 299 fibril_mutex_unlock(&sd.done_mtx); 289 300 290 301 if (sd.ret == EOK)
Note:
See TracChangeset
for help on using the changeset viewer.