RLP with manged code share data- several questions

I’m trying to sample signals in a high rate and send values via network,
in order to achieve better results than in the managed code considering the following
register to interrupts in RLP share data buffer between the RLP and managed code, RLP will add values while manged will read buffer and send over network.

  1. Can RLP and manged share same data?
  2. Is there a way to use same lock for RLP and manged change buffer data should be in a critical section which both RLP and manged should access is this possible?
  3. Another option is to send the data to the network via RLP is this possible?

Byte arrays are sent to RLP as pointers so yes they can share.

I don’t believe you can share locks.

Network to RLP should be as simple as receiving in managed and sending to RLP

1 Like

does RLP and managed run together? if using a few threads in managed?
if yes so is there any way to safely access the shared data?

about the network in RLP, wondered if I can send via RLP - to improve performance.

Managed code does not run while RLP is executing.

Sounds to me like maybe you should look into something like a $2.50 AVR, that ought to be able to cover your use case easily (sadly).

You might need to be careful with this, while this is true you should not rely on this beyond the lifetime of the call to the RLP function. If the RLP function stores that pointer and uses the same pointer later in some other piece of code, like a native interrupt handler or another RLP function etc, the GC might have relocated the original buffer in the meantime.

1 Like


can’t I run few threads from RLP and in one of them call back the manged code- getting RLP and managed run together?

[quote]Sounds to me like maybe you should look into something like a $2.50 AVR, that ought to be able to cover your use case easily (sadly).

what is AVR? can you send me pls relevant links?


There are no threads in RLP, at least that I’ve ever seen implemented. There are interrupts, but only one can be executing at a time.

AVR is the microcontroller used by Arduino (up until the DUE). It performs much better doing some sorts of things, because there’s no managed code. My statement was a bit tongue-in-cheek.

There are tasks in RLP and they are real time. But they suspend the rest of the system when they run.

Do multiple tasks run concurrently?

No they don’t. Like I said, they suspend the rest of the system when they run.

Edit: This is a perfect feature for making something like a custom Signal Generator (OutputCompare)

One of my goals is to create an actual OutputCompare native implementation and associated C# class. There’s no reason it needs to block like the current class does. Just pass it a list of timings and let the ISR handle the work.

I assumed there were threads in RLP (relying on a dicussion here: http://www.tinyclr.com/forum/topic?id=8853 )
and wanted to call teh managed code from another thread in RLP.

I’m trying to do the same, just read the pin instead of writing to it (and bettter get interrupt on value change). but I really don’t want all my code to be in RLP so trying a way to do this together. the managed code perfomance is not good enough for my needs. therefore I’m trying to find a solution using RLP. [line]Any suggestions?, is something like what I’m aiming to possible?
Edit: I am already using Interrupt port in managed but I want better Performance

PinCapture should be quite similar. You’ll need to understand timers, interrupts, and input capture, but essentially you’re going to build a list of timings in RLP and then raise an event when you’re done, and then call into the RLP from managed code to retrieve the timings.