Changeset 7ef162b2 for libcfa/src/concurrency/io.cfa
- Timestamp:
- Nov 22, 2021, 1:07:05 PM (2 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 6ddef36, ddd2ec9
- Parents:
- 059ad16
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r059ad16 r7ef162b2 173 173 174 174 ctx.proc->io.pending = false; 175 176 return __cfa_io_drain( proc ); 175 ready_schedule_lock(); 176 bool ret = __cfa_io_drain( proc ); 177 ready_schedule_unlock(); 178 return ret; 177 179 } 178 180 … … 278 280 } 279 281 280 281 282 //============================================================================================= 282 283 // submission … … 301 302 ctx->proc->io.dirty = true; 302 303 if(sq.to_submit > 30 || !lazy) { 303 ready_schedule_lock();304 304 __cfa_io_flush( ctx->proc, false ); 305 ready_schedule_unlock();306 305 } 307 306 } … … 502 501 } 503 502 } 503 504 bool __kernel_read(processor * proc, io_future_t & future, char buf[], int fd) { 505 $io_context * ctx = proc->io.ctx; 506 /* paranoid */ verify( ! __preemption_enabled() ); 507 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 508 /* paranoid */ verify( ctx ); 509 510 __u32 idx; 511 struct io_uring_sqe * sqe; 512 513 // We can proceed to the fast path 514 if( !__alloc(ctx, &idx, 1) ) return false; 515 516 // Allocation was successful 517 __fill( &sqe, 1, &idx, ctx ); 518 519 sqe->opcode = IORING_OP_READ; 520 sqe->user_data = (uintptr_t)&future; 521 sqe->flags = 0; 522 sqe->ioprio = 0; 523 sqe->fd = 0; 524 sqe->off = 0; 525 sqe->fsync_flags = 0; 526 sqe->__pad2[0] = 0; 527 sqe->__pad2[1] = 0; 528 sqe->__pad2[2] = 0; 529 sqe->addr = (uintptr_t)buf; 530 sqe->len = sizeof(uint64_t); 531 532 asm volatile("": : :"memory"); 533 534 /* paranoid */ verify( sqe->user_data == (uintptr_t)&future ); 535 __submit( ctx, &idx, 1, true ); 536 537 /* paranoid */ verify( proc == __cfaabi_tls.this_processor ); 538 /* paranoid */ verify( ! __preemption_enabled() ); 539 } 504 540 #endif
Note: See TracChangeset
for help on using the changeset viewer.