* [ANN] posix_mq 2.4.0 - POSIX Message Queues for Ruby
@ 2017-03-20 19:52 5% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-20 19:52 UTC (permalink / raw)
To: ruby-talk, ruby-posix-mq
POSIX message queues allow local processes to exchange data in the form
of messages. This API is distinct from that provided by System V
message queues, but provides similar functionality.
* https://bogomips.org/ruby_posix_mq/
* ruby-posix-mq@bogomips.org
* git clone git://bogomips.org/ruby_posix_mq.git
* Atom feed: https://bogomips.org/ruby_posix_mq/NEWS.atom.xml
* Mail archives: https://bogomips.org/ruby-posix-mq/
nntp://news.public-inbox.org/inbox.comp.lang.ruby.posix-mq
* gem install -v 2.4.0 posix_mq
Changes:
Ruby posix_mq 2.4.0
Most notably there are some FreeBSD fixes. There are also
some minor internal cleanups and doc updates.
7 changes since 2.3.0 (2016-02-02):
doc: remove private email address
doc: update bogomips.org URLs to HTTPS
set correct condition for setting id_autoclose
test_posix_mq: get tests passing under FreeBSD 10.3
TypedData C-API conversion
freeze internal objects
build: remove build-time olddoc dependency
^ permalink raw reply [relevance 5%]
* [PATCH] TypedData C-API conversion
@ 2017-03-18 8:27 7% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2017-03-18 8:27 UTC (permalink / raw)
To: ruby-posix-mq
This provides some extra type safety if combined with other
C extensions, as well as allowing us to account for memory usage of
the HTTP parser in ObjectSpace.
This requires Ruby 1.9.3+ and has remained a stable API since
then. This will become officially supported when Ruby 2.3.0 is
released later this month.
This API has only been documented in doc/extension.rdoc (formerly
README.EXT) in the Ruby source tree since April 2015, r50318
---
ext/posix_mq/posix_mq.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/ext/posix_mq/posix_mq.c b/ext/posix_mq/posix_mq.c
index 55ec51e..83e9e58 100644
--- a/ext/posix_mq/posix_mq.c
+++ b/ext/posix_mq/posix_mq.c
@@ -317,11 +317,22 @@ static void _free(void *ptr)
xfree(ptr);
}
+static size_t memsize(const void *ptr)
+{
+ return sizeof(struct posix_mq);
+}
+
+static const rb_data_type_t mqtype = {
+ "posix_mq",
+ { mark, _free, memsize, /* reserved */ },
+ /* parent, data, [ flags ] */
+};
+
/* automatically called at creation (before initialize) */
static VALUE alloc(VALUE klass)
{
struct posix_mq *mq;
- VALUE rv = Data_Make_Struct(klass, struct posix_mq, mark, _free, mq);
+ VALUE rv = TypedData_Make_Struct(klass, struct posix_mq, &mqtype, mq);
mq->des = MQD_INVALID;
mq->autoclose = 1;
@@ -341,7 +352,7 @@ static struct posix_mq *get(VALUE self, int need_valid)
{
struct posix_mq *mq;
- Data_Get_Struct(self, struct posix_mq, mq);
+ TypedData_Get_Struct(self, struct posix_mq, &mqtype, mq);
if (need_valid && mq->des == MQD_INVALID)
rb_raise(rb_eIOError, "closed queue descriptor");
--
EW
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2017-03-18 8:27 7% [PATCH] TypedData C-API conversion Eric Wong
2017-03-20 19:52 5% [ANN] posix_mq 2.4.0 - POSIX Message Queues for Ruby Eric Wong
Code repositories for project(s) associated with this public inbox
https://yhbt.net/ruby_posix_mq.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).