Changeset 5e0b6657 for tests/concurrency/examples
- Timestamp:
- Dec 8, 2025, 11:29:33 AM (2 months ago)
- Branches:
- master, stuck-waitfor-destruct
- Children:
- 79ba50c
- Parents:
- 8f448e0 (diff), 79ec8c3 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- tests/concurrency/examples
- Files:
-
- 2 edited
-
boundedBufferTHREAD.cfa (modified) (4 diffs)
-
datingService.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrency/examples/boundedBufferTHREAD.cfa
r8f448e0 r5e0b6657 10 10 // Created On : Wed Apr 18 22:52:12 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jan 16 23:09:43 202013 // Update Count : 2 512 // Last Modified On : Wed Nov 5 08:05:24 2025 13 // Update Count : 28 14 14 // 15 15 16 #include <stdlib.hfa> // random17 16 #include <fstream.hfa> 18 17 #include <kernel.hfa> … … 65 64 void main( Producer & prod ) with( prod ) { 66 65 for ( i; 1 ~= N ) { 67 yield( random( 5 ) );66 yield( prng( 5 ) ); 68 67 insert( buffer, 1 ); 69 68 } // for … … 81 80 sum = 0; 82 81 for () { 83 yield( random( 5 ) );82 yield( prng( 5 ) ); 84 83 int item = remove( buffer ); 85 84 if ( item == Sentinel ) break; // sentinel ? … … 101 100 processor p; 102 101 103 //srandom( getpid() ); 104 srandom( 1003 ); 102 set_seed( 1003 ); 105 103 106 104 for ( i; Cons ) { // create consumers 107 cons[i] = new( &buffer, sums[i] ); 105 cons[i] = new( &buffer, sums[i] ); // NEW CANNOT HANDLE BUFFER REFERENCE 108 106 } // for 109 107 for ( i; Prods ) { // create producers -
tests/concurrency/examples/datingService.cfa
r8f448e0 r5e0b6657 10 10 // Created On : Mon Oct 30 12:56:20 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Sep 27 15:42:25 202013 // Update Count : 4 012 // Last Modified On : Tue Nov 4 21:58:29 2025 13 // Update Count : 41 14 14 // 15 15 … … 28 28 29 29 unsigned int girl( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) { 30 if ( is_empty( Boys[ccode] ) ) {// no compatible boy ?30 if ( empty( Boys[ccode] ) ) { // no compatible boy ? 31 31 wait( Girls[ccode] ); // wait for boy 32 32 GirlPhoneNo = PhoneNo; // make phone number available … … 40 40 41 41 unsigned int boy( DatingService & mutex ds, unsigned int PhoneNo, unsigned int ccode ) with( ds ) { 42 if ( is_empty( Girls[ccode] ) ) {// no compatible girl ?42 if ( empty( Girls[ccode] ) ) { // no compatible girl ? 43 43 wait( Boys[ccode] ); // wait for girl 44 44 BoyPhoneNo = PhoneNo; // make phone number available
Note:
See TracChangeset
for help on using the changeset viewer.