Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Nested Transaction.Post Ordering #152

Closed
jam40jeff opened this issue Mar 28, 2018 · 1 comment
Closed

Fix Nested Transaction.Post Ordering #152

jam40jeff opened this issue Mar 28, 2018 · 1 comment
Assignees
Labels

Comments

@jam40jeff
Copy link
Contributor

jam40jeff commented Mar 28, 2018

Nested Transaction.Post code should execute after all "top level" Transaction.Post code has executed.

Given the following block of code:

Cell<int> cell = Transaction.Run(() =>
{
	StreamSink<int> s = Stream.CreateSink<int>();
	Transaction.Post(() =>
	{
		s.Send(1);
		Transaction.Post(() => s.Send(3));
	});
	Transaction.Post(() => s.Send(2));
	return s.Hold(0);
});

int result = cell.Sample();

The value of result should be 3, but it currently is 2 due to the nested Transaction.Post code executing before the second top-level Transaction.Post code.

@jam40jeff jam40jeff self-assigned this Mar 28, 2018
@jam40jeff
Copy link
Contributor Author

Fixed by 81b4a7c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant