Changeset 5697:f3a6f503e20e in roaraudio for libroar
- Timestamp:
- 10/14/12 00:11:34 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/scheduler.c
r5696 r5697 58 58 }; 59 59 60 static int __update_cpi_listen_client (struct roar_scheduler * sched, struct roar_scheduler_source * source); 61 60 62 struct roar_scheduler * roar_scheduler_new(int flags, enum roar_scheduler_strategy strategy) { 61 63 struct roar_scheduler * sched = roar_mm_malloc(sizeof(struct roar_scheduler)); … … 247 249 break; 248 250 case ROAR_SCHEDULER_CPI_LISTEN: 249 ROAR_VIO_SELECT_SETVIO(&(sched->vios[i]), cur->vio, ROAR_VIO_SELECT_READ); 250 todo++; 251 vios++; 251 if ( cur->flags & ROAR_SCHEDULER_FLAG_STUB ) 252 __update_cpi_listen_client(sched, cur); 253 254 if ( !(cur->flags & ROAR_SCHEDULER_FLAG_STUB) ) { 255 ROAR_VIO_SELECT_SETVIO(&(sched->vios[i]), cur->vio, ROAR_VIO_SELECT_READ); 256 todo++; 257 vios++; 258 } 252 259 break; 253 260 case ROAR_SCHEDULER_CPI_CLIENT: 254 tmp = 0; 255 256 if ( cur->handle.cpi.impl->status != NULL ) { 257 if ( cur->lhandle != NULL ) 258 roar_dl_context_restore(cur->lhandle); 259 260 para = roar_dl_getpara(cur->lhandle); 261 if ( cur->handle.cpi.impl->status(cur->handle.cpi.client, cur->vio, &(cur->handle.cpi.obuffer), &(cur->handle.cpi.userdata), cur->handle.cpi.protopara, cur->handle.cpi.protoparalen, para) & ROAR_DL_PROTO_STATUS_RX_READY ) 261 if ( cur->flags & ROAR_SCHEDULER_FLAG_STUB ) 262 __update_cpi_listen_client(sched, cur); 263 264 if ( !(cur->flags & ROAR_SCHEDULER_FLAG_STUB) ) { 265 tmp = 0; 266 267 if ( cur->handle.cpi.impl->status != NULL ) { 268 if ( cur->lhandle != NULL ) 269 roar_dl_context_restore(cur->lhandle); 270 271 para = roar_dl_getpara(cur->lhandle); 272 if ( cur->handle.cpi.impl->status(cur->handle.cpi.client, cur->vio, &(cur->handle.cpi.obuffer), &(cur->handle.cpi.userdata), cur->handle.cpi.protopara, cur->handle.cpi.protoparalen, para) & ROAR_DL_PROTO_STATUS_RX_READY ) 273 tmp |= ROAR_VIO_SELECT_READ; 274 if ( para != NULL ) 275 roar_dl_para_unref(para); 276 277 if ( cur->lhandle != NULL ) 278 roar_dl_context_store(cur->lhandle); 279 } else { 262 280 tmp |= ROAR_VIO_SELECT_READ; 263 if ( para != NULL ) 264 roar_dl_para_unref(para); 265 266 if ( cur->lhandle != NULL ) 267 roar_dl_context_store(cur->lhandle); 268 } else { 269 tmp |= ROAR_VIO_SELECT_READ; 270 } 271 272 if ( sched->sources[i]->handle.cpi.obuffer != NULL ) 273 tmp |= ROAR_VIO_SELECT_WRITE; 274 275 ROAR_VIO_SELECT_SETVIO(&(sched->vios[i]), sched->sources[i]->vio, tmp); 276 todo++; 277 vios++; 281 } 282 283 if ( sched->sources[i]->handle.cpi.obuffer != NULL ) 284 tmp |= ROAR_VIO_SELECT_WRITE; 285 286 ROAR_VIO_SELECT_SETVIO(&(sched->vios[i]), sched->sources[i]->vio, tmp); 287 todo++; 288 vios++; 289 } 278 290 break; 279 291 case ROAR_SCHEDULER_PLUGIN: … … 342 354 continue; 343 355 356 if ( cur->flags & ROAR_SCHEDULER_FLAG_STUB ) 357 continue; 358 344 359 if ( cur->cb != NULL ) 345 360 cur->cb(sched->sources[i], sched->sources[i]->userdata, sched->vios[i].eventsa); … … 391 406 case ROAR_SCHEDULER_CPI_CLIENT: 392 407 if ( !sched->vios[i].eventsa ) 408 continue; 409 410 if ( cur->flags & ROAR_SCHEDULER_FLAG_STUB ) 393 411 continue; 394 412 … … 572 590 } 573 591 574 if ( source->handle.cpi.proto > 0 && source->handle.cpi.impl != NULL ) 592 if ( source->handle.cpi.proto > 0 ) { 593 source->flags |= ROAR_SCHEDULER_FLAG_STUB; 594 if ( source->handle.cpi.impl == NULL ) 595 return 0; 596 source->flags -= ROAR_SCHEDULER_FLAG_STUB; 575 597 return 0; 598 } 576 599 577 600 roar_err_set(ROAR_ERROR_INVAL);
Note: See TracChangeset
for help on using the changeset viewer.