[Eventmachine-talk] How to keep a pipe open

Duane Johnson
2007-11-30T13:41:44Z

Thanks for your reply, Roger.  No, I think it''s necessary to close
both sockets--they are to be closed when there is an error condition
(that''s what the if statement is for--it checks if there was an error
while setting the socket nonblocking).

So basically, this is the new, correct code:

	// Set the socketpair nonblocking. Obviously DON''T set CLOEXEC.
	if (!SetSocketNonblocking (sv[0])) {
		close (sv[0]);
		close (sv[1]);
		return NULL;
	}

Can this change go into the core?

Duane


On Nov 29, 2007, at 7:19 PM, Roger Pack wrote:

> maybe there''s an extra close in there?
>
> On Nov 29, 2007 2:51 PM, Duane Johnson <canadaduane at gmail.com>
wrote:
>> Ah-hah!
>>
>> I think I''ve found the problem.  Inside the Socketpair
constructor on
>> line 1386 of em.cpp, it sets both the input AND output sockets to
>> non-
>> blocking:
>>
>>>       // Set the socketpair nonblocking. Obviously DON''T
set
>>> CLOEXEC.
>>>       if (!SetSocketNonblocking (sv[0]) || !SetSocketNonblocking
>>> (sv[1])) {
>>>               close (sv[0]);
>>>               close (sv[1]);
>>>               return NULL;
>>>       }
>>
>>
>> By removing the SetSocketNonblocking(sv[1]) from the line, the TeX
>> command-line application pauses and waits for EventMachine to send
>> data, as expected.
>>
>> If anyone is more familiar with this subject, I would appreciate some
>> feedback here.  Is there some reason the output stream is set to non-
>> blocking?
>>
>>
>> Thanks,
>> Duane Johnson
>> _______________________________________________
>> Eventmachine-talk mailing list
>> Eventmachine-talk at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/eventmachine-talk
>>
>
>
>
> --
> -Roger Pack
> For God hath not given us the spirit of fear; but of power, and of
> love, and of a sound mind" -- 2 Timothy 1:7
> _______________________________________________
> Eventmachine-talk mailing list
> Eventmachine-talk at rubyforge.org
> http://rubyforge.org/mailman/listinfo/eventmachine-talk