------------------------------------------------------------------------------ "sc_thread_process::throw_user" This virtual method is invoked when a user exception is to be thrown. If requested it will also throw the exception to the children of this object instance. The order of dispatch for the processes that are thrown the exception is from youngest child to oldest child and then this process
| 594 | // be suspended |
| 595 | //------------------------------------------------------------------------------ |
| 596 | void sc_thread_process::throw_user( const sc_throw_it_helper& helper, |
| 597 | sc_descendant_inclusion_info descendants ) |
| 598 | { |
| 599 | |
| 600 | // IF THE SIMULATION IS NOT ACTAULLY RUNNING THIS IS AN ERROR: |
| 601 | |
| 602 | if ( sc_get_curr_simcontext()->get_status() != SC_RUNNING ) |
| 603 | { |
| 604 | report_error( SC_ID_THROW_IT_WHILE_NOT_RUNNING_ ); |
| 605 | return; |
| 606 | } |
| 607 | |
| 608 | // IF NEEDED PROPOGATE THE THROW REQUEST THROUGH OUR DESCENDANTS: |
| 609 | |
| 610 | if ( descendants == SC_INCLUDE_DESCENDANTS ) |
| 611 | { |
| 612 | const std::vector<sc_object*> children = get_child_objects(); |
| 613 | int child_n = children.size(); |
| 614 | |
| 615 | for ( int child_i = 0; child_i < child_n; child_i++ ) |
| 616 | { |
| 617 | sc_process_b* child_p = dynamic_cast<sc_process_b*>(children[child_i]); |
| 618 | if ( child_p ) |
| 619 | { |
| 620 | DEBUG_MSG(DEBUG_NAME,child_p,"about to throw user on"); |
| 621 | child_p->throw_user(helper, descendants); |
| 622 | } |
| 623 | } |
| 624 | } |
| 625 | |
| 626 | // IF THE PROCESS IS CURRENTLY UNWINDING IGNORE THE THROW: |
| 627 | |
| 628 | if ( m_unwinding ) |
| 629 | { |
| 630 | SC_REPORT_WARNING( SC_ID_PROCESS_ALREADY_UNWINDING_, name() ); |
| 631 | return; |
| 632 | } |
| 633 | |
| 634 | // SET UP THE THROW REQUEST FOR THIS OBJECT INSTANCE AND QUEUE IT FOR |
| 635 | // EXECUTION: |
| 636 | |
| 637 | if( m_has_stack ) |
| 638 | { |
| 639 | remove_dynamic_events(); |
| 640 | DEBUG_MSG(DEBUG_NAME,this,"throwing user exception to"); |
| 641 | m_throw_status = THROW_USER; |
| 642 | if ( m_throw_helper_p != 0 ) delete m_throw_helper_p; |
| 643 | m_throw_helper_p = helper.clone(); |
| 644 | simcontext()->preempt_with( this ); |
| 645 | } |
| 646 | else |
| 647 | { |
| 648 | SC_REPORT_WARNING( SC_ID_THROW_IT_IGNORED_, name() ); |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | |
| 653 | //------------------------------------------------------------------------------ |
no test coverage detected