+/*
+C implementation of stream::Object::intern_poll
+
+Imported methods signatures:
+ bigint Array_length( Array recv ) for array::AbstractArrayRead::(abstract_collection::Collection::length)
+ nullable_Object Array__index( Array recv, bigint index ) for array::Array::(abstract_collection::SequenceRead::[])
+ int nullable_Object_is_a_bigint( nullable_Object value ) to check if a nullable Object is a Int
+ bigint nullable_Object_as_bigint( nullable_Object value ) to cast from nullable Object to Int
+ int Int_is_null( nullable_Int value ) to check if a nullable Int is a Int
+ bigint bigint_as_not_null( nullable_Int value ) to cast from nullable Int to Int
+*/
+nullable_Int Object_intern_poll___impl( Object recv, Array in_fds, Array out_fds ) {
+ int in_len, out_len, total_len;
+ struct pollfd *c_fds;
+ sigset_t sigmask;
+ int i;
+ nullable_Object tmp_nit_obj;
+ int first_polled_fd = -1;
+ int result;
+
+ in_len = Array_length( in_fds );
+ out_len = Array_length( out_fds );
+ total_len = in_len + out_len;
+ c_fds = malloc( sizeof(struct pollfd) * total_len );
+
+ /* input streams */
+ for ( i=0; i<in_len; i ++ ) {
+ int fd;
+ tmp_nit_obj = Array__index( in_fds, i );
+ fd = nullable_Object_as_Int( tmp_nit_obj );
+
+ c_fds[i].fd = fd;
+ c_fds[i].events = POLLIN;
+ }