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

threads primitive does not work as expected with logging #56

Closed
harendra-kumar opened this issue May 13, 2017 · 2 comments
Closed

threads primitive does not work as expected with logging #56

harendra-kumar opened this issue May 13, 2017 · 2 comments

Comments

@harendra-kumar
Copy link
Contributor

Consider this program:

main = keep $ restore $ do
     r <- logged $ threads 3 $ choose [1..10 :: Int]
     logged $ liftIO $ print ("A",r)
     suspend ()
     logged $ liftIO $ print ("B",r)

This does not perform full 10 iterations.

@agocorona
Copy link
Collaborator

agocorona commented May 31, 2017

restoreassumes that suspend saved info for all the work units. But suspend exit before finishing all the threads. It must not exit when there are alternative thread waiting.

@agocorona
Copy link
Collaborator

agocorona commented Feb 27, 2020

The non-deterministic execution of transient precludes a way to assure that all the possible threads (or executions of the same threads) have passed trough the suspend point, It can not guarantee it. if However we detect that no threads remain active using the threadBlockedInMVarOperationexception used in collect that would imply that some computations would never suspend when some thread remain active waiting for some event. This is not desirable. Therefore this may be left as is, with all these caveats.

That is not because threads n but it makes things more apparent.

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

No branches or pull requests

2 participants