what if rb_eval_string_protect() takes too long?

P

Phlip

Rubies:

Just out of curiosity, suppose a C++ host wants to evaluate a Ruby string,
and that might run long.

Suppose putting Ruby into a thread were against my religion, or something.

Is there a lower level eval() that operates one tick of the Ruby interpreter
at a time? Then I could call it in a loop, and provide a Cancel button for
it.

The other cheap workaround, besides threads, is write a C++ function called
detectCancellation(), bind it to Ruby, and call it from the bottom of the
activities inside the evaluated string.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top