stm Questions
5
Solved
The following program creates two threads running concurrently, that each sleep for a random amount of time, before printing a line of text to stdout.
import Control.Concurrent
import Control.Mona...
Pamphleteer asked 31/12, 2013 at 9:6
1
Solved
The documentation for STM states that:
Using unsafePerformIO inside of atomically is also dangerous but for different reasons. See unsafeIOToSTM for more on this.
When it comes to using thread...
3
Solved
I have 100 workers (agents) that share one ref that contains collection of tasks. While this collection have tasks, each worker get one task from this collection (in dosync block), print it and som...
Tref asked 20/8, 2016 at 13:55
1
Solved
I'm trying to debug a program that uses STM. The ThreadScope readings is pointing out a very high CPU activity as you can see here:
So I'm trying to find out if this is happening due to a transa...
4
Solved
What is the difference between Clojure STM (dosync) approach and Java synchronize Block?
I'm reading the code below from "The sleeping barber" problem.
(http://www.bestinclass.dk/index.clj/2009/0...
Liggett asked 27/8, 2010 at 11:2
2
I need an advice on the data structure to use as an atomic change log.
I'm trying to implement the following algorithm. There is a flow of incoming
changes updating an in-memory map. In Haskell-li...
1
Solved
In this pseudocode block:
atomically $ do
if valueInLocalStorage key
then readValueFromLocalStorage key
else do
value <- unsafeIOToSTM $ fetchValueFromDatabase key
writeValueToLocalStorage ...
Innumerable asked 7/12, 2015 at 10:1
2
Solved
I think I understand the basic difference between the ideas of commute and alter within a Clojure transaction.
alter essentially 'locks' the identity from the start to the end of the transaction so...
1
Solved
I have a transaction failing indefinitely for some reason, and I would like to use trace instructions inside. For example, to print the state of the MVar's before executing the transaction in this ...
1
Solved
I am trying to use channels/STM to implement message passing in Haskell. Maybe this is a terrible idea, and there is a better way to implement/use message passing in Haskell. If this is the case, d...
Tideland asked 20/5, 2015 at 4:15
2
Solved
I'm writing a MUD server in Haskell (MUD = Multi User Dungeon: basically, a multi-user text adventure/role-playing game). The game world data/state is represented in about 15 different IntMaps. My ...
2
Solved
The Problem
Hello! I'm writing a logging library and I would love to create a logger, that would run in separate thread, while all applications threads would just send messages to it. I want to fi...
Adelladella asked 14/1, 2015 at 0:23
1
Solved
There is a function in haskell's stm library with the following type signature:
alwaysSucceeds :: STM a -> STM ()
From what I understand of STM in haskell, there are three ways that something...
2
Solved
The Go language has a select statement that can be used to poll multiple channels and carry out a particular action depending on which channel is non-empty first.
E.g.
select {
case a := <- ...
2
Solved
I've got a situation where I need to compile some Haskell code on different machines.
At least one of these machines has a rather old version of Control.Concurrent.STM, that doesn't know modifyTVar...
Overcharge asked 15/6, 2014 at 19:33
1
Solved
Reading Bartosz Milewski's fantastic blog post on STM, I was excited to read the following:
But take into account an important fact: STM is very fine grained. For
instance, when you’re insertin...
3
Solved
I have a TChan as input for a thread which should behave like this:
If sombody writes to the TChan within a specific time, the content should be retrieved. If there is nothing written within the s...
Quartic asked 4/3, 2014 at 12:24
1
Solved
"Clojure programming" (Emerick, O'Reilly) states, that:
(...) if a new value if commited by another transaction since the beginning of the current transaction, the new value of the ref as of the...
1
Solved
This commentary page describes a lot of the fine details of STM in GHC, but I'd like clarity on a couple points.
First, is a nested transaction invalidated when variables accessed in the parent ch...
Titi asked 17/1, 2014 at 18:44
1
Solved
I am looking into the Concurrency programming in Clojure .
http://clojure.org/concurrent_programming
I got to know that atom, ref and agent forms are used to maintain program state.
Only ref is ...
3
Solved
Disclaimer: This can easily be done using an MVar () as a simple mutex. I'm just curios to see whether it can be done with STM.
I want to do the following atomically:
Read some variables.
Decide...
1
Solved
In my GHC Haskell application utilizing stm, network-conduit and conduit, I have a strand for each socket which is forked automatically using runTCPServer. Strands can communicate with other strand...
Overwork asked 26/5, 2013 at 7:25
2
Solved
I'm wondering how is that possible that Clojure has implemented Software Transactional Memory and doesn't see any problem with that while Microsoft didn't finish its work for C# and noticed some pr...
3
Is there any way to poll whether Clojure's STM transactions are being retried, and at what rate?
1
I am doing things with STM and have among other things used the TBQueue data structure with great success. An useful feature I've been using it for involves reading from it based on a precondition ...
Sparid asked 13/6, 2013 at 21:22
1 Next >
© 2022 - 2024 — McMap. All rights reserved.