Re: Multi-threading how-to

2016-08-31 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Aug 31, 2016 at 05:53:27PM +, Cauterite via Digitalmars-d-learn 
wrote:
> 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.
[...]

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."


Re: Multi-threading how-to

2016-08-31 Thread Cauterite via Digitalmars-d-learn
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.





Multi-threading how-to

2016-08-31 Thread solidstate1991 via Digitalmars-d-learn
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?