[前][次][番号順一覧][スレッド一覧]

ruby-changes:33426

From: ko1 <ko1@a...>
Date: Wed, 2 Apr 2014 20:59:55 +0900 (JST)
Subject: [ruby-changes:33426] ko1:r45505 (trunk): * gc.c, gc.h (rb_objspace_each_objects_without_setup):

ko1	2014-04-02 20:59:50 +0900 (Wed, 02 Apr 2014)

  New Revision: 45505

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45505

  Log:
    * gc.c, gc.h (rb_objspace_each_objects_without_setup):
      Add a new (hidden) C-API to iterate objspace snapshot.
      This API is not safe to call any C-APIs in a given callback
      function. Be careful to use this C-API.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
    trunk/gc.h
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 45504)
+++ ChangeLog	(revision 45505)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Apr  2 20:57:15 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c, gc.h (rb_objspace_each_objects_without_setup): 
+	  Add a new (hidden) C-API to iterate objspace snapshot.
+
+	  This API is not safe to call any C-APIs in a given callback
+	  function. Be careful to use this C-API. 
+
 Wed Apr  2 17:43:17 2014  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (ac_cv_func___builtin_setjmp): gcc 4.9 disallows a
Index: gc.c
===================================================================
--- gc.c	(revision 45504)
+++ gc.c	(revision 45505)
@@ -1788,6 +1788,16 @@ rb_objspace_each_objects(each_obj_callba https://github.com/ruby/ruby/blob/trunk/gc.c#L1788
     }
 }
 
+void
+rb_objspace_each_objects_without_setup(each_obj_callback *callback, void *data)
+{
+    struct each_obj_args args;
+    args.callback = callback;
+    args.data = data;
+
+    objspace_each_objects((VALUE)&args);
+}
+
 struct os_each_struct {
     size_t num;
     VALUE of;
Index: gc.h
===================================================================
--- gc.h	(revision 45504)
+++ gc.h	(revision 45505)
@@ -97,6 +97,10 @@ void rb_objspace_each_objects( https://github.com/ruby/ruby/blob/trunk/gc.h#L97
     int (*callback)(void *start, void *end, size_t stride, void *data),
     void *data);
 
+void rb_objspace_each_objects_without_setup(
+    int (*callback)(void *, void *, size_t, void *),
+    void *data);
+
 RUBY_SYMBOL_EXPORT_END
 
 #endif /* RUBY_GC_H */

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]