Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
1) Failure:
test_listio_read_non_blocking(TestAio) [test/test_aio.rb:28]:
<["one", "two", "three", "four"]> expected but was
<["\x03", "two\xC0o#\x14\xC0", "three,\x14\xC0", "fourO2\x14\xC0"]>.
methodmissing:rb_aio_native lourens$ rake bench
(in /Users/lourens/projects/rb_aio_native)
/opt/local/bin/ruby bench/read.rb
* Bench reads ...
Rehearsal -------------------------------------------------------------
AIO.lio_listio(AIO::WAIT) 0.000000 0.000000 0.000000 ( 0.000100)
IO.read 0.000000 0.000000 0.000000 ( 0.000257)
---------------------------------------------------- total: 0.000000sec
user system total real
1) Failure:
test_listio_read_non_blocking(TestAio) [test/test_aio.rb:27]:
<["one", "two", "three", "four"]> expected but was
<["\x03\x00\x00", "two", "three", "four"]>.
01:50:35 open /opt/local/ruby19/lib/ruby/1.9.1/i386-darwin9.7.0/aio.rb 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/aio.bundle 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000008 ruby
01:50:35 stat /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000009 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/ext/aio/aio.bundle 0.000007 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/test_control_block.rb 0.000009 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/test_control_block.rb 0.000006 ruby
01:50:35 open /Users/lourens/projects/rb_aio_native/test/scratch
/* look for lio_listio LIO_NOP requests and ignore them. */
/* Not really an error, but we need to free our aio_workq_entry. */
if ( entryp->aiocb.aio_lio_opcode == LIO_NOP ) {
result = 0;
goto error_exit;
}
/*
* aio requests queue up on the aio_async_workq or lio_sync_workq (for
* lio_listio LIO_WAIT). Requests then move to the per process aio_activeq
* (proc.aio_activeq) when one of our worker threads start the IO.
* And finally, requests move to the per process aio_doneq (proc.aio_doneq)
* when the IO request completes. The request remains on aio_doneq until
* user process calls aio_return or the process exits, either way that is our
* trigger to release aio resources.
*/
/*
* lio_listio - initiate a list of IO requests. We process the list of aiocbs
* either synchronously (mode == LIO_WAIT) or asynchronously (mode == LIO_NOWAIT).
* The caller gets error and return status for each aiocb in the list via aio_error
* and aio_return. We must keep completed requests until released by the
* aio_return call.
*/
/*
* Helper to ensure files opened via AIO.lio_listio is closed.
*/
static void
rb_io_closes( VALUE cbs ){
int io;
for (io=0; io < RARRAY_LEN(cbs); io++) {
control_block_close( RARRAY_PTR(cbs)[io] );
}
}
static VALUE
control_block_close(VALUE cb)
{
rb_aiocb_t *cbs = GetCBStruct(cb);
if NIL_P(cbs->io) return Qfalse;
/* Free q'd requests on Darwin */
aio_return(&cbs->cb);
rb_io_close(cbs->io);
cbs->io = Qnil;
cbs->rcb = Qnil;
Loaded suite /opt/local/ruby19/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
si_signo 23
si_errno 0
si_code 0
si_pid 0
si_uid 0
si_status 23
si_value.sival_int 0