7sharp9's blog
A cup of tea would restore my normality. - Douglas Adams
agents ast async concurrency csharp elixir elm fable fsharp functional-programming fuse games ios javascript mac mailboxprocessor metaprogramming microsoft mono monodevelop monogame monotouch myriad performance quotations running sockets threading tpl tpl-dataflow typeproviders videos xamarin youtube

© 2011 - 2020 7sharp9

Powered by Hugo with theme Dream.

The Lurking Horror

The Lurking Horror

Sunday, Jul 15, 2012

@ 7sharp9

Deep in the darkest depths lurks an ancient horror, when the time is right it will rise forth and leave you screaming for mercy and begging for forgiveness… OK, I have a penchant for being over dramatic but in this post I am going to reveal some little known caveats in a well known and much revelled area of F#, agents aka the MailboxProcessor. Gasp! First let me give you a demonstration:
FSharp Dataflow agents III

FSharp Dataflow agents III

Monday, Feb 20, 2012

@ 7sharp9

This will be the last post on rebuilding the MailboxProcessor using TDF, here’s a quick discussion of the missing pieces… First, lets start with the simple ones, these don’t really require much discussion. DefaultTimeout let mutable defaultTimeout = Timeout.Infinite member x.DefaultTimeout with get() = defaultTimeout and set(value) = defaultTimeout <- value This simply provides a mutable property using Timeout.Infinite as a default setting. CurrentQueueLength member x.CurrentQueueLength() = incomingMessages.Count Another simple one, this methods uses into the underlying BufferBlock to extract its current queue length using its Count property.
F# Dataflow Agents Part II

F# Dataflow Agents Part II

Monday, Jan 30, 2012

@ 7sharp9

Right, no messing about this time, straight to the code. Construction This is pretty straight forward and I don’t want to detract from the important bits of this post, the only thing of note is the cancellationToken which is initialized to a default value using the defaultArg function if the optional parameter cancellationToken is not supplied. The TDF construct that we to use to perform most of the hard work is incomingMessages which is a BufferBlock<'Msg>.
F# Dataflow Agents Part I

F# Dataflow Agents Part I

Sunday, Jan 22, 2012

@ 7sharp9

This is going to be a new series on using TPL Dataflow with F#. First a little bit of history and background. TPL Dataflows heritage and background TPL Dataflow or (TDF) has been around for quite a while, it first surfaced more than a year ago as the successor to the Concurrency and Coordination Runtime (CCR) and with coming release of .Net 4.5 it will be part of the System.Threading.Tasks.Dataflow namespace.
Agent based scheduling

Agent based scheduling

Sunday, Jul 3, 2011

@ 7sharp9

One of the areas that I am very interested in is agents and I have been doing quite a lot of work in this area lately. Agents can be used for a multitude of different purposes ranging from: isolated message passing, object caching, finite state machines, web crawling, and even reactive user interfaces. One of the ideas that I have been looking into lately is agent based scheduling.SchedulerAgent A simple Agent based scheduler:
 Agents and ObjectPools

Agents and ObjectPools

Sunday, Jun 5, 2011

@ 7sharp9

Everyone knows F# agents are cool right? Well here’s yet another example of how versatile they can be… There was a series of posts last April by Stephen Toub from the pfxteam at Microsoft. I was reading through some of the posts again the other day and thought some of the ideas presented there would make interesting projects in F# to demonstrate the flexibility and succinctness of the language. I thought the ObjectPool example would make an interesting project in F# using agents aka MailboxProcessors.

About Me

Hi, my name is Dave Thomas and Im a software engineer from the Uk. I work primarily in F# but also like to tinker with pretty much any interesting language. Im drawn to more functional languages like F#, Swift and Rust.

Have questions or suggestions? Feel free to ask me on Twitter.

Thanks for reading!

Dave Thomas