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

Added the System trait #41

Merged
2 commits merged into from
Apr 20, 2016
Merged

Added the System trait #41

2 commits merged into from
Apr 20, 2016

Conversation

kvark
Copy link
Member

@kvark kvark commented Apr 19, 2016

Closes #30

The new code somehow introduces a deadlock in the tests. AFAIK, all I did was changing a pulse/barrier into a channel.

@kvark
Copy link
Member Author

kvark commented Apr 19, 2016

Weird, if I move the same test code into the example, it works.
@csherratt do you see anything wrong here?

@ghost
Copy link

ghost commented Apr 19, 2016

The test case that is failing is test_panics. I probably should have used something like timebomb to check for tests like this.
The test case is checking to see if the task panicking propagates to the dispatch thread. With pulse a pulse would be dropped forcing it into an error state. This would propagate to anything waiting on the pulse.
My guess is this is not the behavior of mpsc, it probably only enters an error state if all produces have been hung up. Which can't happen since you hold your own sender side.

@kvark
Copy link
Member Author

kvark commented Apr 19, 2016

@csherratt thanks for figuring this out! So what can be done to fix it nicely then?

@ghost
Copy link

ghost commented Apr 19, 2016

Easiest way, add a drop guard to do the send in the case of a task panicking. This is the same technique the threadpool is doing internally. Well they spawn a thread, you would transmit the message.

https://github.com/frewsxcv/rust-threadpool/blob/master/src/lib.rs#L29-L60

@kvark
Copy link
Member Author

kvark commented Apr 20, 2016

@csherratt the more I look at threadpool the more I realize that we are essentially building on top of it without actually hooking up to the same internal mechanisms. We'd benefit from tighter integration. so perhaps we should just hand-craft something similar manually.

@kvark kvark changed the title [WIP] Added the System trait Added the System trait Apr 20, 2016
@ghost ghost merged commit b2f5497 into amethyst:master Apr 20, 2016
@ghost
Copy link

ghost commented Apr 20, 2016

@kvark I don't disagree on the threadpool Their implementation is pretty much wait on a mutex for work to arrive. It's simple, but obviously sub-optimal.

@kvark kvark deleted the system branch April 20, 2016 15:21
xMAC94x pushed a commit to xMAC94x/specs that referenced this pull request Mar 10, 2021
41: Remove dependency on unstable feature r=torkleyy
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant