On 02/04/2013 05:35 PM, Martin Sustrik wrote:
Hi Chuck!I don't have an objection but I do want to point out an interesting use-case we discovered on the 0mq side related to initialization. The default values for various socket options oftentimes need to be overridden with new values. There is a zmq_ctx_set()/zmq_ctx_get() function pair for resetting these global values. This is far more convenient than setting socket options every time a socket is created. I recommend something similar for nanomsg. The init/term functions may disappear but the concept of a global state should probably remain.First of all, the global state does actually exist, so it is technically possible to set process-wide properties. From the theoretic perspective, the question of global properties is an interesting one. One principle that should hold, IMO, is that moving a thread from one process to another one should not break what it does. I.e. it should not corrupt its business logic. The implication is that global properties should not affect *what* particular socket does, although they can affect *how* it does it (QoS). What we get is the classic mechanism/policy separation, where policy options can be global (process scope, machine scope, even topology scope), but mechanism options are always local to the socket. Martin
Hi,In my usecase(Process threads spread out over cores), I would see global state within a process as a definite problem. Where cache-line bouncing of global state data-structures would become a very problematic artefact, if accessed "under the hood" when creating and/or destroying a socket.
Br, David