digitalmars.D.learn - Multi-threading how-to
- solidstate1991 (7/7) Aug 31 2016 I decided to write a shared library for OSC in D despite the lack
- Cauterite (11/14) Aug 31 2016 What you're describing here is not actually multi-threading, it's
- H. S. Teoh via Digitalmars-d-learn (7/23) Aug 31 2016 [...]
I decided to write a shared library for OSC in D despite the lack of popularity. I decided to add a functionality that if multiple programs use the same instance of the library on the same computer, the messages will be passed directly instead of via networking. Unfortunately we barely touched multi-threading in college. Some suggestions?
Aug 31 2016
On Wednesday, 31 August 2016 at 17:37:25 UTC, solidstate1991 wrote:I decided to add a functionality that if multiple programs use the same instance of the library on the same computer, the messages will be passed directly instead of via networking.What you're describing here is not actually multi-threading, it's multi-process…ing. The keyword you're looking for is "inter-process communication". You have a huge range of possible options for implementing this. Your decision would depend on your operating system, your existing implementation with sockets, and desired performance. My suggestion: try just using sockets between processes on the same PC. You might not even need to add any new code to support this method, and it might be faster than you'd expect.
Aug 31 2016
On Wed, Aug 31, 2016 at 05:53:27PM +0000, Cauterite via Digitalmars-d-learn wrote:On Wednesday, 31 August 2016 at 17:37:25 UTC, solidstate1991 wrote:[...] If you're on Posix (Linux, *nix, etc.), you could also use pipes, which may be easier to setup. T -- A linguistics professor was lecturing to his class one day. "In English," he said, "A double negative forms a positive. In some languages, though, such as Russian, a double negative is still a negative. However, there is no language wherein a double positive can form a negative." A voice from the back of the room piped up, "Yeah, yeah."I decided to add a functionality that if multiple programs use the same instance of the library on the same computer, the messages will be passed directly instead of via networking.What you're describing here is not actually multi-threading, it's multi-process…ing. The keyword you're looking for is "inter-process communication". You have a huge range of possible options for implementing this. Your decision would depend on your operating system, your existing implementation with sockets, and desired performance. My suggestion: try just using sockets between processes on the same PC. You might not even need to add any new code to support this method, and it might be faster than you'd expect.
Aug 31 2016