Monday April 26, 2010

[Time] NameMessage
[06:33] sjampoo Hmm, i'm looking at pub.cpp. Shouldn't the message flushing come before closing all the message objects? What if the ffn callback from zmq_msg_close clears the data?
[06:47] sjampoo Ah got it, please ignore that last question.
[07:28] sustrik sjampoo: :)
[07:44] sjampoo Hmm if i just send my messages, i do not really need to close them right, as this gets done on a successful send anyway?
[08:03] sustrik sjampoo: now you are speaking of internals of pub_t right?
[08:03] sustrik consider this scenario:
[08:03] sustrik user sends message with refcount 1
[08:04] sustrik pub_t writes it to a pipe
[08:04] sustrik leaves the refcount to be 1
[08:04] sustrik it ommits close thus not decreasing the refcount
[08:05] sustrik and inits user's copy of the message to be blank
[08:05] sustrik the refcount of the original message is still 1
[08:06] sustrik but nows it refers to the pointer in the pipe rather than pointer in user's zmq_msg_t object
[08:12] sjampoo a-ha!
[08:12] sjampoo thanks.
[09:54] sustrik sjampoo: btw, if you find places like this in the code, where it's not obvious what the code is doing feel free to write a comment explaining the behaviour and submit it as a patch
[09:54] sustrik it'll help improve overall quality of the codebase
[14:51] CIA-5 zeromq2: 03Martin Sustrik 07master * rbeffee9 10/ (8 files in 3 dirs): P2P renamed to PAIR -
[14:59] CIA-5 zeromq2: 03Martin Sustrik 07master * r1ad6ade 10/ builds/msvc/libzmq/libzmq.vcproj : MSVC build fixed -
[15:42] CIA-5 rbzmq: 03Martin Sustrik 07master * r9f1b337 10/ (perf/local_lat.rb rbzmq.cpp): P2P renamed to PAIR -
[15:49] CIA-5 clrzmq: 03Martin Sustrik 07master * r52a9158 10/ clrzmq/zmq.cs : P2P renamed to PAIR -
[16:17] mikko sustrik: there?
[16:18] sustrik nikko__: yes, hi
[16:18] mikko
[16:18] mikko might not be C++ish
[16:18] mikko noticed a TODO item
[16:19] sustrik ah, i see
[16:19] sustrik the ugly thing about it is that is has to be done at 3 places
[16:20] mikko yeah
[16:20] sustrik jon dyte is working on merging all 3 devices into a single executable which would allow for having it at a single place
[16:20] mikko i guess it would be easy to write a macro
[16:20] mikko or something
[16:20] mikko that works as well
[16:21] sustrik you may want to synchronise with him
[16:21] sustrik he seems busy so we would surely appreciate patches like this one
[16:21] mikko im not sure how you are supposed to cast in C++
[16:22] sustrik ()
[16:22] sustrik (int) x
[16:22] mikko with const_cast, static_cast and reinterpret_cast
[16:22] sustrik well, you mostly don't need those
[16:22] mikko was reading about casts last night in C++
[16:22] mikko seems a lot more confusing than C :)
[16:22] sustrik they are useful only for casting types with virtual function tables
[16:23] sustrik ah, not so for const_cast
[16:23] sustrik anyway, I would stick to (int) x
[16:24] mikko you can cast const char * with (int) ?
[16:24] sustrik i mean (type) x
[16:25] sustrik braces syntax
[16:25] mikko const char *foo = "123412423"; int x = (int) foo; ?
[16:25] sustrik you'll get numeric representation of the pointer to the string :)
[16:26] mikko yeah, that's what i expected
[16:26] sustrik atoi is OK
[16:26] sustrik anyway, to give you some context
[16:27] sustrik the xml files for devices should define a lot of properties
[16:27] sustrik aside of io_threads, it's all the socket options
[16:27] sustrik so the code will be rather long
[16:27] sustrik thus having it 3x in the codebase seems to be a bad idea
[16:28] sustrik that's why I would prefer to have devices merged first
[16:28] sustrik then add the property-managing code
[17:01] impl mikko__: you should use intptr_t for that though
[17:04] sustrik impl: i think this is only a theoretical discussion, no need for that kind of thing in the code
[17:05] impl ah
[17:09] mikko impl: i'm not storing a pointer
[17:09] mikko just casting const char * to integer
[17:09] mikko or i was wondering how do you cast that in C++
[17:10] mikko if there was some magic
[21:02] ADruz Can zeromq serve as a job queue system?
[21:03] mikko not really without added application logic
[21:04] mikko take a look at gearman or citrine scheduler if you want job queue / scheduling functionality