I have C ++ code that implements a special protocol through a serial port. The code is multi-threaded and internally polled by the serial port and performs its cyclic processing. I would like to name this driver from erlang, and also receive events from this driver. My concern is that this C ++ code is multi-threaded, as well as statefull, which means that when a certain function is called in the driver, it caches everything inside, which will be used / required for subsequent calls to the driver. My questions
1. Does NIF go in the same os process as my other erlang processes or does NIF run in a separate os process?
2. Does it make sense to deform this multi-threaded C ++ code with NIF support?
4. If NIF is not suitable, the best way for me is to make Elrang speak back and forth with this C ++ code. I also prefer that my C ++ code be inside the same OS process as the rest of my Erlang processes, and since it seems like related drivers are an option, but are not sure the multi-threaded nature of my code in C ++ will be fine model. Plus, I heard that they can ruin the elrang scheduler?
iCode source
share