Skip to content

Instantly share code, notes, and snippets.

@ramsingla
Created June 21, 2010 04:55
Show Gist options
  • Save ramsingla/446415 to your computer and use it in GitHub Desktop.
Save ramsingla/446415 to your computer and use it in GitHub Desktop.
#Curl Multi 0.4.6.0
if (rb_block_given_p()) {
rb_yield(self);
}
tv.tv_sec = timeout / 1000;
tv.tv_usec = (timeout * 1000) % 1000000;
rc = rb_thread_select(maxfd+1, &fdread, &fdwrite, &fdexcep, &tv);
if (rc < 0) {
rb_raise(rb_eRuntimeError, "select(): %s", strerror(errno));
}
# multi_run with read
rb_curl_multi_run( self, rbcm->handle, &(rbcm->running) );
#Curl Multi ( master )
rc = rb_thread_select(maxfd+1, &fdread, &fdwrite, &fdexcep, &tv);
switch(rc) {
case -1:
rb_raise(rb_eRuntimeError, "select(): %s", strerror(errno));
break;
case 0:
if (block != Qnil) {
rb_funcall(block, rb_intern("call"), 1, self);
}
rb_curl_multi_read_info( self, rbcm->handle );
default:
# multi run without read
rb_curl_multi_run( self, rbcm->handle, &(rbcm->running) );
break;
}
}
rb_curl_multi_read_info( self, rbcm->handle );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment