[Boost-users] [boost.asio / asio] leaving descriptor open in posix::stream_descriptor

62 views
Skip to first unread message

Daniel Mierswa

unread,
Dec 22, 2010, 3:18:40 AM12/22/10
to asio-...@lists.sourceforge.net, boost...@lists.boost.org
Hey there,
is it possible to avoid closing the descriptor when the destructor
of posix::{basic_,}stream_descriptor is called?
I guess I have to roll my own service or something else but I don't know
where to start, I'm also sending this to the boost mailing list.

--
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply know better than you do.
--- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Boris Schaeling

unread,
Dec 22, 2010, 6:22:54 PM12/22/10
to boost...@lists.boost.org, asio-...@lists.sourceforge.net
On Wed, 22 Dec 2010 09:18:40 +0100, Daniel Mierswa <imp...@impulze.org>
wrote:

> Hey there,
> is it possible to avoid closing the descriptor when the destructor
> of posix::{basic_,}stream_descriptor is called?

Unfortunately it isn't (stream_descriptor always owns the file descriptor).

> I guess I have to roll my own service or something else but I don't know
> where to start, I'm also sending this to the boost mailing list.

I also would like to see a stream_descriptor which doesn't own the file
descriptor as right now you can't share ownership with other objects
(that's why I had to add a release() method to the handle class in the
latest Boost.Process draft as ownership must be passed from handle to
stream_descriptor).

Boris

Daniel Mierswa

unread,
Dec 23, 2010, 8:55:21 PM12/23/10
to boost...@lists.boost.org
On 23.12.2010 00:22, Boris Schaeling wrote:
> On Wed, 22 Dec 2010 09:18:40 +0100, Daniel Mierswa
> <imp...@impulze.org> wrote:
>> I guess I have to roll my own service or something else but I
>> don't know where to start, I'm also sending this to the boost
>> mailing list.
>
> I also would like to see a stream_descriptor which doesn't own the
> file descriptor as right now you can't share ownership with other
> objects (that's why I had to add a release() method to the handle
> class in the latest Boost.Process draft as ownership must be passed
> from handle to stream_descriptor).
>
> Boris

I guess one could ::dup/::fcntl it to create a shared file descriptor
and give that to asio. What do you think of that?

--
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply know better than you do.
--- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22

Boris Schaeling

unread,
Dec 24, 2010, 11:43:45 AM12/24/10
to boost...@lists.boost.org
On Fri, 24 Dec 2010 02:55:21 +0100, Daniel Mierswa <imp...@impulze.org>
wrote:

> On 23.12.2010 00:22, Boris Schaeling wrote:
>> On Wed, 22 Dec 2010 09:18:40 +0100, Daniel Mierswa
>> <imp...@impulze.org> wrote:
>>> I guess I have to roll my own service or something else but I
>>> don't know where to start, I'm also sending this to the boost
>>> mailing list.
>>
>> I also would like to see a stream_descriptor which doesn't own the
>> file descriptor as right now you can't share ownership with other
>> objects (that's why I had to add a release() method to the handle
>> class in the latest Boost.Process draft as ownership must be passed
>> from handle to stream_descriptor).
>>
>> Boris
>
> I guess one could ::dup/::fcntl it to create a shared file descriptor
> and give that to asio. What do you think of that?

Sounds good to me and should work. :)

Boris

Reply all
Reply to author
Forward
0 new messages