sync/channels: use references for `chan mut X` testcase (#6145)
							parent
							
								
									2aedece23d
								
							
						
					
					
						commit
						0c7d73c8b0
					
				|  | @ -6,12 +6,16 @@ const ( | ||||||
| 
 | 
 | ||||||
| struct St { | struct St { | ||||||
| mut: | mut: | ||||||
|  | 	dummy  i64 | ||||||
|  | 	dummy2 u32 | ||||||
|  | 	dummy3 i64 | ||||||
| 	n      int | 	n      int | ||||||
|  | 	dummy4 int | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // this function gets an array of channels for `St` references
 | // this function gets an array of channels for `St` references
 | ||||||
| fn do_rec_calc_send(chs []chan mut St) { | fn do_rec_calc_send(chs []chan mut St) { | ||||||
| 	mut s := St{} | 	mut s := &St(0) | ||||||
| 	for { | 	for { | ||||||
| 		if !(&sync.Channel(chs[0])).pop(&s) { | 		if !(&sync.Channel(chs[0])).pop(&s) { | ||||||
| 			break | 			break | ||||||
|  | @ -24,7 +28,7 @@ fn do_rec_calc_send(chs []chan mut St) { | ||||||
| fn test_channel_array_mut() { | fn test_channel_array_mut() { | ||||||
| 	mut chs := [chan mut St{cap: 1}, chan mut St{}] | 	mut chs := [chan mut St{cap: 1}, chan mut St{}] | ||||||
| 	go do_rec_calc_send(chs) | 	go do_rec_calc_send(chs) | ||||||
| 	mut t := St{ | 	mut t := &St{ | ||||||
| 		n: 100 | 		n: 100 | ||||||
| 	} | 	} | ||||||
| 	for _ in 0 .. num_iterations { | 	for _ in 0 .. num_iterations { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue