/* * call-seq: * thgrp.enclose => thgrp * * Prevents threads from being added to or removed from the receiving * <code>ThreadGroup</code>. New threads can still be started in an enclosed * <code>ThreadGroup</code>. * * ThreadGroup::Default.enclose #=> #<ThreadGroup:0x4029d914> * thr = Thread::new { Thread.stop } #=> #<Thread:0x402a7210 sleep> * tg = ThreadGroup::new #=> #<ThreadGroup:0x402752d4> * tg.add thr * * <em>produces:</em> * * ThreadError: can't move from the enclosed thread group */ static VALUE thgroup_enclose(group) VALUE group; { struct thgroup *data; Data_Get_Struct(group, struct thgroup, data); data->enclosed = 1; return group; }