Join GitHub today
Custom control flow #85
I am trying to write user space device drivers using Monifu.
I have a USB port exposed as an Observable and Subscriber for reading and writing bits, similar to a Scalaz Exchange.
The driver must sequence requests sent to the device, that is, once a request is written to the device, the next one should be written only after a response is received. Furthermore, if a response is not received within a specified timeout, the first request must be retried.
I do not want to add this sequencing logic in the client. A client should be able to send any number of requests and the driver should sequence it appropriately.
Are there any examples for such custom processing? Any help will be much appreciated.
For posterity, I was able to solve the problem by updating the driver state defined as
@ajaychandran sorry for not helping you out with this. I haven't received the GitHub notification, saw your question later, postponed it, then forgot about it :-)
BTW, I would model the business logic itself by means of the
@alexandru No problems. The time spent in coming with the solution led to a deeper understanding of the library and the problem.
A USB port is modeled as a
PS: Thanks for creating this library. It is much easier to follow (IMO) than the competition and handles terminal conditions correctly*.
val ref = RefCountCancelable(println("completed")) Seq.fill(10)(ref.acquire()).foreach(_.cancel())
I am using a custom
val ref = RefCountCancelable(println("completed")) Seq.fill(10)(ref.acquire()).foreach(_.cancel()) ref.cancel() // <-- needs this call to work
You see, by doing