digitalmars.D - LibEvent, signals or communication between threads
- Shadow_exe (11/11) May 08 2012 Hello everyone.
- Gor Gyolchanyan (6/17) May 08 2012 Try looking at std.concurrency.
- Shadow_exe (6/27) May 08 2012 Yes, there is some communication between the thread, but it is
- sclytrack (3/18) May 08 2012 Andrei's "Concurrency in the D programming language". You can google it.
- =?UTF-8?B?QWxpIMOHZWhyZWxp?= (8/33) May 08 2012 I have written a chapter about the same:
- Shadow_exe (9/50) May 08 2012 Thank You! As would there sometimes You have helped.
- Sean Kelly (24/29) May 08 2012 not found this information that have been granted to You - I've read.
- Sean Kelly (10/17) May 08 2012 other, they do not know, but I want to create a dialogue between the th...
Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.
May 08 2012
Try looking at std.concurrency. You'll find a message passing mechanism there. On Tue, May 8, 2012 at 2:25 PM, Shadow_exe <shadow_exe ukr.net> wrote:Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.-- Bye, Gor Gyolchanyan.
May 08 2012
Yes, there is some communication between the thread, but it is locked and the thread waits for him not come something like a signal. My task is not to block the trade and send a signal in this thread. On Tuesday, 8 May 2012 at 14:29:37 UTC, Gor Gyolchanyan wrote:Try looking at std.concurrency. You'll find a message passing mechanism there. On Tue, May 8, 2012 at 2:25 PM, Shadow_exe <shadow_exe ukr.net> wrote:Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.
May 08 2012
On 05/08/2012 04:29 PM, Gor Gyolchanyan wrote:Try looking at std.concurrency. You'll find a message passing mechanism there. On Tue, May 8, 2012 at 2:25 PM, Shadow_exe<shadow_exe ukr.net> wrote:Andrei's "Concurrency in the D programming language". You can google it. http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.
May 08 2012
On 05/08/2012 09:00 AM, sclytrack wrote:On 05/08/2012 04:29 PM, Gor Gyolchanyan wrote:I have written a chapter about the same: http://ddili.org/ders/d.en/concurrency.html Although not directly related, the "Thread names" title there has an example where two threads discover each other by their names. Ali -- D Programming Language Tutorial: http://ddili.org/ders/d.en/index.htmlTry looking at std.concurrency. You'll find a message passing mechanism there. On Tue, May 8, 2012 at 2:25 PM, Shadow_exe<shadow_exe ukr.net> wrote:Andrei's "Concurrency in the D programming language". You can google it. http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.
May 08 2012
Thank You! As would there sometimes You have helped. But I'm afraid that these methods me not suitable because libevent already creates a queue and turn me not to come out to do. Information how to send that is the signal to the next thread I have not found this information that have been granted to You - I've read. Okay, I will do through юниксовые sockets. On Tuesday, 8 May 2012 at 17:09:53 UTC, Ali Çehreli wrote:On 05/08/2012 09:00 AM, sclytrack wrote:On 05/08/2012 04:29 PM, Gor Gyolchanyan wrote:I have written a chapter about the same: http://ddili.org/ders/d.en/concurrency.html Although not directly related, the "Thread names" title there has an example where two threads discover each other by their names. AliTry looking at std.concurrency. You'll find a message passing mechanism there. On Tue, May 8, 2012 at 2:25 PM, Shadow_exe<shadow_exe ukr.net> wrote:Andrei's "Concurrency in the D programming language". You can google it. http://www.informit.com/articles/article.aspx?p=1609144&seqNum=7Hello everyone. Faced with an interesting challenge, and how to solve it and found no tracks. The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each other, they do not know, but I want to create a dialogue between the thread. I want to first thread could tell the second thread to perform some function. The queue is implemented through a library libevent. Who faced a similar problem or just knows how to solve this issue - please help.
May 08 2012
On May 8, 2012, at 11:13 AM, Shadow_exe wrote:Thank You! As would there sometimes You have helped. But I'm afraid that these methods me not suitable because libevent =already creates a queue and turn me not to come out to do.Information how to send that is the signal to the next thread I have =not found this information that have been granted to You - I've read.=20 Okay, I will do through =D1=8E=D0=BD=D0=B8=D0=BA=D1=81=D0=BE=D0=B2=D1=8B==D0=B5 sockets. std.concurrency uses a condition variable internally to signal the = waiting thread when new messages have arrived. As this is an = implementation detail, it isn't exposed to the user. libevent is unfortunately somewhat limited in the events that can be = monitored. It's pretty much just read/write events on a file = descriptor, so using a socket or pipe is about the only way to notify a = thread blocked on a libevent queue. libev is more flexible in the range = of events it offers. I believe there's even a user-triggered event, = though I bet this still uses a pipe internally. And you're still stuck = with the problem of sending the message and then separately triggering = the event. Really, messaging doesn't seamlessly integrate with high-performance = socket IO. Once Phobos gets a better networking API I'd like to provide = a shim to proxy data to/from a socket Erlang-style, but that approach is = really only desirable for simple cases, and cases where performance = isn't a significant concern (since it tends to involve a lot of memory = churn). Beyond that=E2=80=A6 maybe I can cook up some way to let the = user plug a notification mechanism into the message queue, so when a = message is received, if nothing is waiting on the condition variable the = other notification mechanism is used instead.=
May 08 2012
On May 8, 2012, at 3:25 AM, "Shadow_exe" <shadow_exe ukr.net> wrote:Hello everyone. Faced with an interesting challenge, and how to solve it and found no trac=ks.The problem is the following: I have 2 thread, which are created in the main flow, respectively, of each=other, they do not know, but I want to create a dialogue between the thread= . I want to first thread could tell the second thread to perform some functi= on.The queue is implemented through a library libevent. =20 Who faced a similar problem or just knows how to solve this issue - please=help. If you're already using libevent you can either send the message via a socke= t or send the message using std.concurrency and then signal the other thread= by writing to a socket it's reading. You can call receiveTimeout(0) to not b= lock on receive.=20=
May 08 2012