[zeromq-dev] C# socket_close Syntax

Ben Kloosterman bklooste at gmail.com
Tue Nov 8 05:14:10 CET 2011


Yes it is incorrect ...

In C #You
1. Manually call Dispose()  to free it immediately.
2. Use a using block to state code where its active and the compiler will 
call Dispose()
3. The Gc will call Dispose()  which is only recommended for resources that 
are not heavily constrained.

2 is the preferred solution for most situations and bypasses some trickyness 
but in all cases "DIspose()"  should dispose of resources.

Ben

-----Original Message----- 
From: Paul Betts
Sent: Tuesday, November 08, 2011 12:02 PM
To: ZeroMQ development list
Cc: Ilja Golshtein ; lanre lawal
Subject: Re: [zeromq-dev] C# socket_close Syntax

I don't believe this is correct, the correct way to close a Socket in
C# is to Dispose() it.

On Mon, Nov 7, 2011 at 2:22 AM, Martin Sustrik <sustrik at 250bpm.com> wrote:
> On 11/07/2011 11:17 AM, Ilja Golshtein wrote:
>> 07.11.2011, 13:54, "Martin Sustrik"<sustrik at 250bpm.com>:
>>> However, adding the functionality is easy (have a look at other language
>>> bindings for inspiration), so I suggest you add the function yourself
>>> and ask clrzmq2 maintainers to merge it into the project.
>>
>> Not sure such an attempt to bypass GC is natural from C# standpoint.
>
> Other bindings for languages with GCs do the same thing. See, for
> exmaple, here;
>
> https://github.com/zeromq/jzmq/blob/master/src/org/zeromq/ZMQ.java#L334
>
> Martin
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev 




More information about the zeromq-dev mailing list