Changes in / [2325b57:00f89a6]
- Location:
- doc/uC++toCFA
- Files:
-
- 2 edited
-
.gitignore (modified) (1 diff)
-
uC++toCFA.tex (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/uC++toCFA/.gitignore
r2325b57 r00f89a6 3 3 *.pdf 4 4 *.ps 5 *.cc6 *.cfa -
doc/uC++toCFA/uC++toCFA.tex
r2325b57 r00f89a6 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Wed Nov 13 18:09:58202414 %% Update Count : 6 20713 %% Last Modified On : Mon Nov 11 21:51:39 2024 14 %% Update Count : 6144 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 fields550 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 fields562 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 575 542 \section{\lstinline{COBEGIN}/\lstinline{COFOR}} 576 543 … … 691 658 692 659 660 \section{Thread} 661 662 \begin{cquote} 663 \begin{tabular}{@{}l|ll@{}} 664 \begin{uC++} 665 666 @_Task@ T { 667 // private task fields 668 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 fields 680 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@ Barrier734 : @public uBarrier@ { // inheritance735 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;@ // containment771 int total;772 };773 void ?{}( Barrier & B, unsigned int group ) with(B) {774 @?{}( b, group );@ // initialize barrier775 total = 0;776 }777 unsigned int block( Barrier & B, int subtotal ) with(B) {778 @mutex( b )@ { total += subtotal; } // use barrier's mutual exclusion779 void @last@() { sout | total; } // called by Gth arriving thread780 @block@( b, last ); // wait for barrier trigger781 }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 \newpage803 723 804 724 \section{Monitor} … … 869 789 \end{cquote} 870 790 871 \ enlargethispage{1000pt}791 \newpage 872 792 873 793 External Scheduling
Note:
See TracChangeset
for help on using the changeset viewer.