Changes in / [00f89a6:2325b57]
- Location:
- doc/uC++toCFA
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/uC++toCFA/.gitignore
r00f89a6 r2325b57 3 3 *.pdf 4 4 *.ps 5 *.cc 6 *.cfa -
doc/uC++toCFA/uC++toCFA.tex
r00f89a6 r2325b57 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Mon Nov 11 21:51:39202414 %% Update Count : 6 14413 %% Last Modified On : Wed Nov 13 18:09:58 2024 14 %% Update Count : 6207 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 540 540 541 541 542 \section{Thread} 543 544 \begin{cquote} 545 \begin{tabular}{@{}l|ll@{}} 546 \begin{uC++} 547 548 @_Task@ T { 549 // private task fields 550 void main() { 551 ... @_Resume E( ... ) _At partner@; 552 ... @uThisTask();@ ... 553 } 554 public: 555 }; 556 \end{uC++} 557 & 558 \begin{cfa} 559 #include <$thread$.hfa> 560 @thread@ T { 561 // private task fields 562 563 }; 564 void main( @T & t@ ) { 565 ... @resumeAt( partner, ExceptionInst( E, ... )@ ); 566 ... @active_thread();@ ... 567 } 568 \end{cfa} 569 \\ 570 \multicolumn{2}{@{}l@{}}{\lstinline{T t; // start thread in main routine}} 571 \end{tabular} 572 \end{cquote} 573 574 542 575 \section{\lstinline{COBEGIN}/\lstinline{COFOR}} 543 576 … … 658 691 659 692 660 \section{Thread}661 662 \begin{cquote}663 \begin{tabular}{@{}l|ll@{}}664 \begin{uC++}665 666 @_Task@ T {667 // private task fields668 void main() {669 ... _Resume E( ... ) _At partner;670 ... uThisTask(); ...671 }672 public:673 };674 \end{uC++}675 &676 \begin{cfa}677 #include <$thread$.hfa>678 @thread@ T {679 // private task fields680 681 };682 void main( @T & t@ ) {683 ... resumeAt( partner, ExceptionInst( E, ... ) );684 ... active_thread(); ...685 }686 \end{cfa}687 \\688 \multicolumn{2}{@{}l@{}}{\lstinline{T t; // start thread in main routine}}689 \end{tabular}690 \end{cquote}691 692 693 693 \section{Locks} 694 694 … … 721 721 \end{cquote} 722 722 723 724 \section{Barrier} 725 726 \begin{cquote} 727 \begin{tabular}{@{}l|ll@{}} 728 \begin{uC++} 729 #include <iostream> 730 using namespace std; 731 #include <uBarrier.h> 732 733 @_Cormonitor@ Barrier 734 : @public uBarrier@ { // inheritance 735 int total; 736 public: 737 Barrier( unsigned int group ) : 738 @uBarrier( group )@ { 739 total = 0; 740 } 741 void @block@( int subtotal ) { 742 total += subtotal; 743 @uBarrier::block();@ 744 } 745 private: 746 void @last@() { cout << total << endl; } 747 }; 748 enum { N = 3 }; 749 Barrier b{ N }; 750 751 _Task T { 752 void main() { 753 for ( int i = 0; i < 10; i += 1 ) { 754 b.block( 1 ); 755 } 756 } 757 }; 758 int main() { 759 uProcessor p[N - 1]; 760 T t[N]; 761 } 762 \end{uC++} 763 & 764 \begin{cfa} 765 #include <fstream.hfa> 766 #include <$thread$.hfa> 767 #include <barrier.hfa> 768 #include <mutex_stmt.hfa> 769 struct Barrier { 770 @barrier b;@ // containment 771 int total; 772 }; 773 void ?{}( Barrier & B, unsigned int group ) with(B) { 774 @?{}( b, group );@ // initialize barrier 775 total = 0; 776 } 777 unsigned int block( Barrier & B, int subtotal ) with(B) { 778 @mutex( b )@ { total += subtotal; } // use barrier's mutual exclusion 779 void @last@() { sout | total; } // called by Gth arriving thread 780 @block@( b, last ); // wait for barrier trigger 781 } 782 783 784 enum { N = 3 }; 785 Barrier b{ N }; 786 787 thread T {}; 788 void main( T & ) { 789 for ( 10 ) { 790 block( b, 1 ); 791 } 792 } 793 794 int main() { 795 processor p[N - 1]; 796 T t[N]; 797 } 798 \end{cfa} 799 \end{tabular} 800 \end{cquote} 801 802 \newpage 723 803 724 804 \section{Monitor} … … 789 869 \end{cquote} 790 870 791 \ newpage871 \enlargethispage{1000pt} 792 872 793 873 External Scheduling
Note: See TracChangeset
for help on using the changeset viewer.