scheme_make_type and places

22 views
Skip to first unread message

Sergey Pinaev

unread,
Feb 27, 2015, 6:21:15 AM2/27/15
to racke...@googlegroups.com
hi.
scheme_make_type uses global variable type_names, that gets extended every time i call scheme_make_type().
if i use places and my place is requires some extension that calls scheme_make_type() - every time the place is
created - new scheme type created. when it reaches number 507 - i got sigsegv.
because gc->mark_table have fixed size and 507 is btc_redirect_bi_chan.
right now i'm workaround this in extensions by doing something like:
for (n = 0; n < scheme_num_types(); n++) {
      if (strcmp(scheme_get_type_name(n), "<my-type>") == 0) {
...
but i think it is not "right" way.

Matthew Flatt

unread,
Feb 27, 2015, 10:23:59 AM2/27/15
to Sergey Pinaev, racke...@googlegroups.com
That seems like an ok approach. Using scheme_register_process_global()
to record the type registration might be better, especially if you're
concerned about conflicts.
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-dev+...@googlegroups.com.
> To post to this group, send email to racke...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-dev/a1351839-2f34-495a-8bc1-45a5de12cc
> 67%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sergey Pinaev

unread,
Mar 2, 2015, 4:40:12 AM3/2/15
to racke...@googlegroups.com, drf....@gmail.com
That seems like an ok approach. Using scheme_register_process_global()
to record the type registration might be better, especially if you're
concerned about conflicts.

i dont think so. there still can be race, because  type_names is not "protected' by any semaphore.
and even if it will be protected - it will require programmer to know about it and write something like
"get lock, call scheme_register_process_global, if it returns null - call scheme_make_type, release lock".
not so "user friendly", imho =)
also having dynamicaly growable type_names and static mark_table is... hm. "surprising", at least.
and this behavior isn't described anywhere.

Sergey Pinaev

unread,
Mar 2, 2015, 5:45:02 AM3/2/15
to racke...@googlegroups.com, drf....@gmail.com
i dont think so. there still can be race, because  type_names is not "protected' by any semaphore.

i give my words back. just looked at scheme_register_process_global.
anyway it is not so "intuitive" way of doing things =)
Reply all
Reply to author
Forward
0 new messages