Re: calling ach_open on an already open ach_channel_t

20 views
Skip to first unread message

Neil T. Dantam

unread,
Dec 7, 2014, 7:22:34 PM12/7/14
to ach-...@googlegroups.com, Eric Huang
On 12/06/2014 03:17 PM, Eric Huang wrote:
> Is there a way to detect if an ach_channel_t is already open?

No. Unitialized structs have undefined values, so we cannot tell the
difference between garbage and an open channel only by looking at the
ach_channel_t struct.

> Is it safe to call ach_open on an already open channel?

If you mean passing an ach_channel_t struct that is already opened,
then no, but probably this will only leak a file descriptor.
Impossible to check this in ach_open() because unitialized structs
have undefined values.

You can of course open the same channel multiple times using different
ach_channel_t structs.

Cheers,
--
Neil T. Dantam
http://www.Neil.Dantam.name
Reply all
Reply to author
Forward
0 new messages