summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJoey Hess2015-10-21 16:59:06 -0400
committerJoey Hess2015-10-21 16:59:06 -0400
commitdd7812b3d814ecea6124d3cbedc329f6c6851bef (patch)
treeab7e6579567f7313884497b4c3e0f2bf3bf2ebca /doc
parent061e66e0d8d22105f99e806efcfa2c86a211e3f1 (diff)
thoughts
Diffstat (limited to 'doc')
-rw-r--r--doc/todo/concurrency.mdwn31
1 files changed, 26 insertions, 5 deletions
diff --git a/doc/todo/concurrency.mdwn b/doc/todo/concurrency.mdwn
index 712747f0..fa0e22ea 100644
--- a/doc/todo/concurrency.mdwn
+++ b/doc/todo/concurrency.mdwn
@@ -19,14 +19,35 @@ off a sub-process to ensure the property.
If forkProcess could be used, it could fork a subprocess that knows the
action it's to perform, and jiggers stdio to feed through a pipe back to the
-parent. But, I have had bad luck in the past using forkProcess in haskell,
+parent.
+
+But, I have had bad luck in the past using forkProcess in haskell,
in combination with the -threaded runtime.
+ forkProcess comes with a giant warning: since any other running threads
+ are not copied into the child process, it's easy to go wrong: e.g.
+ by accessing some shared resource that was held by another thread in
+ the parent.
+
+It may well be that since propellor has very
+little shared resources, and properties are run quite independently of
+one-another, a forkProcess to run a property might not be a problem.
+
+At least, until someone gets creative:
+
+ foo = property "foo" $ do
+ v <- liftIO newEmptyMVar
+ ensureProperty $
+ foo v `race` bar v -- FAIL
+
+We could detect if inside ensureProperty and refuse to do anything
+concurrent because the user might be up to such tricks.
+
---
-Instead, execing a new process would work. But, how to tell that
-sub-process be told which property it's supposed to
-ensure? There's no property serialization, and not even a Eq to use.
+Instead of forking, execing a new process would work. But, how to tell that
+sub-process which property it's supposed to ensure? There's no property
+serialization, and not even a Eq to use.
Hmm, if it could come up with a stable, unique Id for each property, then
the sub-process could be told the Id, and it'd then just look through its
@@ -51,7 +72,7 @@ x y a b are not top-level properties of a Host, so won't get unique Id's.
Unless we can build up some tree of Id's that can be walked from the
top-level down to the sub-properties, this won't work. Help?
-Also, what about mixing concurrently with ensureProperty?
+Also, what about mixing concurrency with ensureProperty?
foo = property "foo" $ do
liftIO defCon5