Re: better c fibers

2021-09-28 Thread Kagamin via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote: Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. On windows you can use the fiber api https://docs.microsoft.com/en-us/windows/

Re: better c fibers

2021-09-27 Thread Dukc via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote: Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. Is there another way how to use async/await in dlang better c? Thank you for your

Re: better c fibers

2021-09-26 Thread SealabJaster via Digitalmars-d-learn
On Sunday, 26 September 2021 at 09:48:58 UTC, SealabJaster wrote: ... I feel I didn't make it clear enough that extracting the code would be way too much effort than its worth, especially since I'm not even sure it runs on Linux. So I really wouldn't suggest going down that route.

Re: better c fibers

2021-09-26 Thread SealabJaster via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote: ... I'm not aware of any -betterC package specifically for coroutines. I have some work done in this regard, but sadly the library itself isn't really usable at all so if you want to put in the effort you'd have to probably extract t

Re: better c fibers

2021-09-26 Thread Imperatorn via Digitalmars-d-learn
On Tuesday, 21 September 2021 at 09:37:30 UTC, Abby wrote: Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. Is there another way how to use async/await in dlang better c? Thank you for your

better c fibers

2021-09-21 Thread Abby via Digitalmars-d-learn
Hi there, I'm new in dlang I specially like betterC. I was hoping that d fibers would be implemented in without using classes, but there are not. Is there another way how to use async/await in dlang better c? Thank you for your help Abby

Re: KQueue and Fibers

2021-04-10 Thread rashir via Digitalmars-d-learn
On Friday, 9 April 2021 at 18:37:43 UTC, Jacob Carlborg wrote: On 2021-04-09 11:00, rashir wrote: Goodmorning everyone, I'm trying to understand both Kqueue and Fiber's operation on Mac. Why don't I get the correct data as long as I read from the socket? It seems to be reading too early, but K

Re: KQueue and Fibers

2021-04-09 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-04-09 11:00, rashir wrote: Goodmorning everyone, I'm trying to understand both Kqueue and Fiber's operation on Mac. Why don't I get the correct data as long as I read from the socket? It seems to be reading too early, but Kquue tells me that the socket is readable. ```D    const

Re: KQueue and Fibers

2021-04-09 Thread rashir via Digitalmars-d-learn
On Friday, 9 April 2021 at 09:49:24 UTC, Arjan wrote: On Friday, 9 April 2021 at 09:00:17 UTC, rashir wrote: Goodmorning everyone, I'm trying to understand both Kqueue and Fiber's operation on Mac. Why don't I get the correct data as long as I read from the socket? It seems to be reading too e

Re: KQueue and Fibers

2021-04-09 Thread Arjan via Digitalmars-d-learn
On Friday, 9 April 2021 at 09:00:17 UTC, rashir wrote: Goodmorning everyone, I'm trying to understand both Kqueue and Fiber's operation on Mac. Why don't I get the correct data as long as I read from the socket? It seems to be reading too early, but Kquue tells me that the socket is readable.

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 27 September 2020 at 16:39:45 UTC, Ali Çehreli wrote: On 9/27/20 6:33 AM, Ferhat Kurtulmuş wrote: > [...] Kurtulmuş wrote: >> [...] wrote: > [...] processing > [...] How many flame threads do you need? I thought one image processor and one flame thrower, no? Even if you hav

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ali Çehreli via Digitalmars-d-learn
On 9/27/20 6:33 AM, Ferhat Kurtulmuş wrote: > On Sunday, 27 September 2020 at 12:05:13 UTC, Ferhat Kurtulmuş wrote: >> On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote: >>> On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote: > > Oh, It will work fine if I imitate my time-consuming image pr

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 27 September 2020 at 12:05:13 UTC, Ferhat Kurtulmuş wrote: On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote: On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote: Oh, It will work fine if I imitate my time-consuming image processing like this. I think it is Ok now. import st

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote: On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote: > __gshared DList!Entry queue; > __gshared bool shouldRun = true; Have you considered passing messages with std.concurrency.send() and std.concurrency.receive() and friends? You wouldn

Re: A scheduled control signal with fibers?

2020-09-27 Thread Imperatorn via Digitalmars-d-learn
On Sunday, 27 September 2020 at 10:52:58 UTC, Ferhat Kurtulmuş wrote: On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote: [...] [...] I remember that your book covers passing messages with send(). Probably I will rewrite it using that mechanism, you are right, I noticed that

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote: On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote: Have you considered passing messages with std.concurrency.send() and std.concurrency.receive() and friends? You wouldn't need 'queue' because all of your threads already have mail box

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ali Çehreli via Digitalmars-d-learn
On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote: > __gshared DList!Entry queue; > __gshared bool shouldRun = true; Have you considered passing messages with std.concurrency.send() and std.concurrency.receive() and friends? You wouldn't need 'queue' because all of your threads already have mail boxe

Re: A scheduled control signal with fibers?

2020-09-27 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:37:09 UTC, Steven Schveighoffer wrote: Given the rate and the number of concurrent tasks, I'd say threads. -Steve Here is my testable and minimal code using 1 extra thread. Thank you all! import core.thread; import std.stdio; import std.concurrency; im

Re: A scheduled control signal with fibers?

2020-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/25/20 9:16 AM, Ferhat Kurtulmuş wrote: On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] No need for fibers per se. You can run 2 threads. One that produces {time: now + 1500.msecs, value

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:13:50 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] No need for fibers per se. You can run 2 threads. One that produces {time: now + 1500.msecs, value: getFlameIntensityViaImageProcessing} objects

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
On Friday, 25 September 2020 at 13:08:16 UTC, Sebastiaan Koppe wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers? No need for fibers per se. Can also use https://code.dlang.org

Re: A scheduled control signal with fibers?

2020-09-25 Thread Sebastiaan Koppe via Digitalmars-d-learn
// a possible solution: // enum afterNmilliseconds = 1500; // schedulePWMSignalToValve(pwmval, afterNmilliseconds ); ... } ... } How can I implement schedulePWMSignalToValve(pwmval, afterNmilliseconds ) using fibers? Thanks in advance. No need for fibers per

Re: A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
On Friday, 25 September 2020 at 12:43:41 UTC, Imperatorn wrote: On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: [...] A naive implementation would be to store 1500 ms worth of data with the pwm values, like a buffer. I guess memory is not a problem if you're using a RP3

Re: A scheduled control signal with fibers?

2020-09-25 Thread Imperatorn via Digitalmars-d-learn
On Friday, 25 September 2020 at 11:58:53 UTC, Ferhat Kurtulmuş wrote: Hi, I have a problem to solve that may be solved using fibers. I have no previous experience with fibers. We are working on a variable-rate weeder. A camera is installed in front of a tractor. A flame weeder is connected

A scheduled control signal with fibers?

2020-09-25 Thread Ferhat Kurtulmuş via Digitalmars-d-learn
Hi, I have a problem to solve that may be solved using fibers. I have no previous experience with fibers. We are working on a variable-rate weeder. A camera is installed in front of a tractor. A flame weeder is connected to the behind of a tractor. Doing image processing (on RP3), we

Re: Fibers and std.socket

2020-05-22 Thread ikod via Digitalmars-d-learn
On Friday, 22 May 2020 at 06:10:38 UTC, Atwork wrote: Is it possible to mix fibers with sockets from phobos? If so, how would I do it? Like just a simple example of async sockets using fibers in D. I will say that I'd prefer to not use any packages ex. vibe.d Yes you can mix std so

Fibers and std.socket

2020-05-21 Thread Atwork via Digitalmars-d-learn
Is it possible to mix fibers with sockets from phobos? If so, how would I do it? Like just a simple example of async sockets using fibers in D. I will say that I'd prefer to not use any packages ex. vibe.d

Re: Bug with profiling GC with multiple threads/fibers

2019-09-12 Thread Joel via Digitalmars-d-learn
On Sunday, 21 April 2019 at 16:20:51 UTC, WebFreak001 wrote: I'm trying to GC profile serve-d which uses a lot of fibers potentially also across some threads and some threads doing some dedicated work, however -profile=gc doesn't seem to work properly. It logs `shared static this`

Bug with profiling GC with multiple threads/fibers

2019-04-21 Thread WebFreak001 via Digitalmars-d-learn
I'm trying to GC profile serve-d which uses a lot of fibers potentially also across some threads and some threads doing some dedicated work, however -profile=gc doesn't seem to work properly. It logs `shared static this` calls and some methods, however none of the actual stuff is in

Using fibers

2018-08-03 Thread solidstate1991 via Digitalmars-d-learn
I'm porting LZHAM to D, and the original used some very unusual approach for coroutines: - the whole thing is running inside of a single switch-case block created by C++ macros - the function saves some local values - a macro sets the state variable to the current line number, returns the st

Re: Are Fibers just broken in D?

2018-04-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 10:12 PM, bitwise wrote: On Friday, 20 April 2018 at 18:58:36 UTC, Byron Moxie wrote: [...] In WIN32 it looks like its leaking memory Unless there is something I'm misunderstanding, it seems that Fibers that were not run to completion won't unroll their stack, which w

Re: Are Fibers just broken in D?

2018-04-24 Thread bitwise via Digitalmars-d-learn
On Friday, 20 April 2018 at 18:58:36 UTC, Byron Moxie wrote: [...] In WIN32 it looks like its leaking memory Unless there is something I'm misunderstanding, it seems that Fibers that were not run to completion won't unroll their stack, which would mean that some destructors w

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 4:30 PM, Steven Schveighoffer wrote: I'll file an issue. We may not be able to solve the problem, but it's something we should try and solve. Seems there's already a similar issue in there: https://issues.dlang.org/show_bug.cgi?id=3523 -Steve

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: [...] This is not a fiber issue but a more memory management issue. Your run out of address space on win32, the GC will not always collect all those 9 fibers that you allocate in that loop. As an exercise replace `auto` with

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
00:46:39 UTC, Byron Heads wrote: [...] This is not a fiber issue but a more memory management issue. Your run out of address space on win32, the GC will not always collect all those 9 fibers that you allocate in that loop. As an exercise replace `auto` with `scope` like `scope foo = new

Re: Are Fibers just broken in D?

2018-04-24 Thread rikki cattermole via Digitalmars-d-learn
On 25/04/2018 5:13 AM, Steven Schveighoffer wrote: On 4/24/18 12:49 PM, kinke wrote: On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 12:49 PM, kinke wrote: On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also I have a feeling a client will ask for it. Unfortu

Re: Are Fibers just broken in D?

2018-04-24 Thread kinke via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 16:22:04 UTC, Steven Schveighoffer wrote: On 4/24/18 10:31 AM, Byron Heads wrote: I will start ignoring win32 when win64 doesn't require dealing with visual studio installs. Also I have a feeling a client will ask for it. Unfortunately I don't think the VS license

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 10:31 AM, Byron Heads wrote: On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: This is not the case of executing 100,000 concurrent fibers, but executing 100,000 *sequential* fibers. It should work just fine. Correct, in a normal run of my system there maybe

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
a more memory management issue. Your run out of address space on win32, the GC will not always collect all those 9 fibers that you allocate in that loop. As an exercise replace `auto` with `scope` like `scope foo = new Foo();` in that loop - you should see different results. This shouldn&#

Re: Are Fibers just broken in D?

2018-04-24 Thread Byron Heads via Digitalmars-d-learn
On Tuesday, 24 April 2018 at 13:36:48 UTC, Steven Schveighoffer wrote: On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: Fibers on Win32 have a memory leak for sure: import core.thread

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
. Your run out of address space on win32, the GC will not always collect all those 9 fibers that you allocate in that loop. As an exercise replace `auto` with `scope` like `scope foo = new Foo();` in that loop - you should see different results. This shouldn't be a requirement, the 32-b

Re: Are Fibers just broken in D?

2018-04-24 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/24/18 5:11 AM, bauss wrote: On Tuesday, 24 April 2018 at 07:58:01 UTC, Radu wrote: On Tuesday, 24 April 2018 at 00:46:39 UTC, Byron Heads wrote: Fibers on Win32 have a memory leak for sure: import core.thread : Fiber; void main() {     foreach(ulong i; 0..99_999) {     auto foo

Re: Are Fibers just broken in D?

2018-04-24 Thread bauss via Digitalmars-d-learn
afe in all places. FWIW, I'm using vibe.d on Linux 64 bit with no problems (and I've NEVER heard of atomicLoad and atomicStore not working on any arch). -Steve I had move the data I wanted to sync with atomicLoad/Store into a shared struct and pass a pointer to this struct to th

Re: Are Fibers just broken in D?

2018-04-24 Thread Radu via Digitalmars-d-learn
64 bit with no problems (and I've NEVER heard of atomicLoad and atomicStore not working on any arch). -Steve I had move the data I wanted to sync with atomicLoad/Store into a shared struct and pass a pointer to this struct to the other fibers. Not sure if this was an issue with TLS

Re: Are Fibers just broken in D?

2018-04-23 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/23/18 8:46 PM, Byron Heads wrote: Fibers on Win32 have a memory leak for sure: import core.thread : Fiber; void main() {     foreach(ulong i; 0..99_999) {     auto foo = new Foo();     foo.call();     foo.call();     } } It sure looks like this should be fine, the GC

Re: Are Fibers just broken in D?

2018-04-23 Thread Byron Heads via Digitalmars-d-learn
Load and atomicStore not working on any arch). -Steve I had move the data I wanted to sync with atomicLoad/Store into a shared struct and pass a pointer to this struct to the other fibers. Not sure if this was an issue with TLS messing with class object I was passing around. Fibers on

Re: Are Fibers just broken in D?

2018-04-20 Thread Byron Moxie via Digitalmars-d-learn
had move the data I wanted to sync with atomicLoad/Store into a shared struct and pass a pointer to this struct to the other fibers. Not sure if this was an issue with TLS messing with class object I was passing around.

Re: Are Fibers just broken in D?

2018-04-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 4/20/18 2:58 PM, Byron Moxie wrote: I am working on an application that makes heavy use of Fibers pools that are processed by a thread pool. In WIN32 it looks like its leaking memory then it segfaults (I am guessing its an OOM). I am also trying to use Semaphores and/or Conditions on

Re: Are Fibers just broken in D?

2018-04-20 Thread rikki cattermole via Digitalmars-d-learn
On 21/04/2018 6:58 AM, Byron Moxie wrote: I am working on an application that makes heavy use of Fibers pools that are processed by a thread pool. In WIN32 it looks like its leaking memory then it segfaults (I am guessing its an OOM). I am also trying to use Semaphores and/or Conditions on

Are Fibers just broken in D?

2018-04-20 Thread Byron Moxie via Digitalmars-d-learn
I am working on an application that makes heavy use of Fibers pools that are processed by a thread pool. In WIN32 it looks like its leaking memory then it segfaults (I am guessing its an OOM). I am also trying to use Semaphores and/or Conditions on shared data between fibers, which results

Re: vibe.d with explicit threads/threadpool instead of fibers

2016-10-25 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Tuesday, 25 October 2016 at 21:23:21 UTC, Arun Chandrasekaran wrote: I am looking for a RESTful framework in D, which can interact with an existing backend processes (C++) via ZeroMQ and shared memory. I thought vibe.d might be a viable option. But I discussed with someone on Freenode #d and

vibe.d with explicit threads/threadpool instead of fibers

2016-10-25 Thread Arun Chandrasekaran via Digitalmars-d-learn
I am looking for a RESTful framework in D, which can interact with an existing backend processes (C++) via ZeroMQ and shared memory. I thought vibe.d might be a viable option. But I discussed with someone on Freenode #d and found that vibe.d doesn't support explicit threading [1]. Can someone

Re: Fibers, what for?

2016-06-13 Thread chmike via Digitalmars-d-learn
On Monday, 13 June 2016 at 00:57:11 UTC, Alex Parrill wrote: This is misleading. Any sort of cooperative system needs synchronization when two or more tasks try to access the same data, whether those "tasks" are OS threads, fibers, different machines on a network, etc. That is t

Re: Fibers, what for?

2016-06-12 Thread Ali Çehreli via Digitalmars-d-learn
synchronization as if you were using threads. Vibe.d framework share the same fibers between threads? Or each thread have his own fibers? I was trying this(shared fibers) but it didnt work. D fibers don't (actually, can't) move between threads. Vibe.d uses regular D fibers, so it&#x

Re: Fibers, what for?

2016-06-12 Thread Patric Dexheimer via Digitalmars-d-learn
. Vibe.d framework share the same fibers between threads? Or each thread have his own fibers? I was trying this(shared fibers) but it didnt work.

Re: Fibers, what for?

2016-06-12 Thread Alex Parrill via Digitalmars-d-learn
On Sunday, 12 June 2016 at 08:38:03 UTC, chmike wrote: Fibers don't need synchronization to access shared data. This removes the overhead of synchronization and simplifies "multitheaded" programming greatly. This is misleading. Any sort of cooperative system needs synchronizat

Re: Fibers, what for?

2016-06-12 Thread chmike via Digitalmars-d-learn
On Sunday, 12 June 2016 at 05:11:57 UTC, Ali Çehreli wrote: For convenience, here's the link: http://www.ustream.tv/recorded/86352137/highlight/699197 unfortunately iPads are not supported to view the video. :( I see two major benefits of fibers overs threads. Fibers don&#

Re: Fibers, what for?

2016-06-11 Thread Ali Çehreli via Digitalmars-d-learn
On 06/11/2016 07:58 PM, Era Scarecrow wrote: > recent DConf 2016 which sorta covers this For convenience, here's the link: http://www.ustream.tv/recorded/86352137/highlight/699197 However although I'm very biased :), I still like the following fiber explanation that emphasizes function cal

Re: Fibers, what for?

2016-06-11 Thread Era Scarecrow via Digitalmars-d-learn
On Sunday, 12 June 2016 at 02:43:40 UTC, Patric Dexheimer wrote: I learned about Fibers on D, and now I´m starting to read about it (Threads/Fibers/Coroutines) etc. But when I try to make something usefull with it I just fail to see the real advantage over a normal structured programming

Fibers, what for?

2016-06-11 Thread Patric Dexheimer via Digitalmars-d-learn
I learned about Fibers on D, and now i´m starting to read about it (Threads/Fibers/Coroutines) etc. But when i try to make something usefull with it i just fail to see the real advantage over a normal structured programming without it. Can someone show some code with usefull/unique

Re: Fibers under the hood

2016-06-09 Thread Jack Stouffer via Digitalmars-d-learn
On Thursday, 9 June 2016 at 16:13:21 UTC, Jonathan Marler wrote: I don't see that documentation anywhere on that page. https://issues.dlang.org/show_bug.cgi?id=16148

Re: Fibers under the hood

2016-06-09 Thread Jonathan Marler via Digitalmars-d-learn
7;t found too much on how fibers are implemented. How does yield return execution to the caller but then resume execution in the same place on the next call? Also some information on how the fiber call stack works would be nice. I'm assuming it allocates the stack on the GC heap. If

Re: Fibers under the hood

2016-06-09 Thread Andrew Edwards via Digitalmars-d-learn
On 6/9/16 2:15 PM, Jonathan Marler wrote: On Thursday, 9 June 2016 at 05:07:33 UTC, Nikolay wrote: On Thursday, 9 June 2016 at 04:57:30 UTC, Jonathan Marler wrote: I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yi

Re: Fibers under the hood

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
On Thursday, 9 June 2016 at 05:07:33 UTC, Nikolay wrote: On Thursday, 9 June 2016 at 04:57:30 UTC, Jonathan Marler wrote: I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yield return execution to the caller but t

Re: Fibers under the hood

2016-06-08 Thread Nikolay via Digitalmars-d-learn
On Thursday, 9 June 2016 at 04:57:30 UTC, Jonathan Marler wrote: I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yield return execution to the caller but then resume execution in the same place on the next call?

Fibers under the hood

2016-06-08 Thread Jonathan Marler via Digitalmars-d-learn
I've googled and searched through the forums but haven't found too much on how fibers are implemented. How does yield return execution to the caller but then resume execution in the same place on the next call? Also some information on how the fiber call stack works would be

Re: [Code Example for Beginners (like me)] Sockets with Fibers

2015-09-18 Thread Alex Parrill via Digitalmars-d-learn
On Friday, 18 September 2015 at 07:58:10 UTC, ddos wrote: hello! yesterday i got curious about how fibers work, and if the can be used as a replacement in network programming. so i started hacking a small example together, which is hopefully useful to other D beginners too :) http

[Code Example for Beginners (like me)] Sockets with Fibers

2015-09-18 Thread ddos via Digitalmars-d-learn
hello! yesterday i got curious about how fibers work, and if the can be used as a replacement in network programming. so i started hacking a small example together, which is hopefully useful to other D beginners too :) http://pastebin.com/Xg4GJbKE

Re: Where can i find examples of multi-threaded fibers?

2015-07-28 Thread Rob T via Digitalmars-d-learn
On Monday, 27 July 2015 at 18:30:06 UTC, Gary Willoughby wrote: Where is the discussion? This must be it http://forum.dlang.org/thread/pflkijjjuyyhextxv...@forum.dlang.org I'm interested in the same subject right now, and was wondering about the same question you asked.

Re: Where can i find examples of multi-threaded fibers?

2015-07-27 Thread Gary Willoughby via Digitalmars-d-learn
On Monday, 27 July 2015 at 08:00:10 UTC, Marc Schütz wrote: On Sunday, 26 July 2015 at 18:07:51 UTC, Gary Willoughby wrote: In the description for Fiber in std.thread is the following[1]: "Please note that there is no requirement that a fiber be bound to one specific thread. Rather, f

Re: Where can i find examples of multi-threaded fibers?

2015-07-27 Thread via Digitalmars-d-learn
On Sunday, 26 July 2015 at 18:07:51 UTC, Gary Willoughby wrote: In the description for Fiber in std.thread is the following[1]: "Please note that there is no requirement that a fiber be bound to one specific thread. Rather, fibers may be freely passed between threads so long as they ar

Re: Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Gary Willoughby via Digitalmars-d-learn
On Sunday, 26 July 2015 at 19:51:08 UTC, Ali Çehreli wrote: On 07/26/2015 11:07 AM, Gary Willoughby wrote:> In the Thanks for the example. I'll study it.

Re: Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Ali Çehreli via Digitalmars-d-learn
On 07/26/2015 11:07 AM, Gary Willoughby wrote:> In the description for Fiber in std.thread is the following[1]: > > "Please note that there is no requirement that a fiber be bound to one > specific thread. Rather, fibers may be freely passed between threads so > long as th

Where can i find examples of multi-threaded fibers?

2015-07-26 Thread Gary Willoughby via Digitalmars-d-learn
In the description for Fiber in std.thread is the following[1]: "Please note that there is no requirement that a fiber be bound to one specific thread. Rather, fibers may be freely passed between threads so long as they are not currently executing." How would this be accomplish

Re: CPU cores & threads & fibers

2015-06-18 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-06-16 18:36:09 +, Rob T said: FYI: https://issues.dlang.org/show_bug.cgi?id=11686 https://issues.dlang.org/show_bug.cgi?id=11687 Thanks. We are currently experimenting to see how want to use the threads and what code to refactor. If we are going to bite the bullet I keep this in

Re: CPU cores & threads & fibers

2015-06-16 Thread Rob T via Digitalmars-d-learn
On Sunday, 14 June 2015 at 15:54:30 UTC, Etienne Cimon wrote: On 2015-06-14 08:35, Robert M. Münch wrote: Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use severa

Re: CPU cores & threads & fibers

2015-06-15 Thread Robert M. Münch via Digitalmars-d-learn
On 2015-06-14 15:54:30 +, Etienne Cimon said: Yes, however nothing really guarantees multi-threading = multi-core. The kernel reserves the right and will most likely do everything possible to keep your process core-local to use caching efficiently. Hi, sure. It's more about raising the ch

Re: CPU cores & threads & fibers

2015-06-14 Thread via Digitalmars-d-learn
On Sunday, 14 June 2015 at 12:35:44 UTC, Robert M. Münch wrote: Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use several CPU cores Is that right? Fib

Re: CPU cores & threads & fibers

2015-06-14 Thread Etienne Cimon via Digitalmars-d-learn
On 2015-06-14 08:35, Robert M. Münch wrote: Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use several CPU cores Is that right? Yes, however nothing really guar

Re: CPU cores & threads & fibers

2015-06-14 Thread John Colvin via Digitalmars-d-learn
On Sunday, 14 June 2015 at 12:35:44 UTC, Robert M. Münch wrote: Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use several CPU cores Is that right? Pretty much.

CPU cores & threads & fibers

2015-06-14 Thread Robert M. Münch via Digitalmars-d-learn
Hi, just to x-check if I have the correct understanding: fibers = look parallel, are sequential => use 1 CPU core threads = look parallel, are parallel => use several CPU cores Is that right? -- Robert M. Münch http://www.saphirion.com smarter | better | faster

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
On Friday, 24 April 2015 at 12:38:39 UTC, Jens Bauer wrote: On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Jens Bauer via Digitalmars-d-learn
On Friday, 24 April 2015 at 09:15:21 UTC, Chris wrote: I was more thinking of the audio thread. But the audio is probably better off in a separate thread. I think you could do this too. In fact, this is very similar to how the audio from a MOD file is decoded. (I only mentioned an interrupt,

Re: Fibers and async io stuff for beginners

2015-04-24 Thread Chris via Digitalmars-d-learn
moment I'm using threads to implement a speech synthesizer. It waits for input, synthesizes it, and then "speaks" in a separate thread. If new input comes, the speaking thread is stopped. I wonder, if fibers would be a viable alternative to threads (after all audio playback was m

Re: Fibers and async io stuff for beginners

2015-04-23 Thread Jens Bauer via Digitalmars-d-learn
r. It waits for input, synthesizes it, and then "speaks" in a separate thread. If new input comes, the speaking thread is stopped. I wonder, if fibers would be a viable alternative to threads (after all audio playback was mentioned in the list above). I'll try and give you s

Re: Fibers and async io stuff for beginners

2015-04-23 Thread Chris via Digitalmars-d-learn
. This is great information. I didn't know anything about Fibers before today. Since I started looking at D, I've seen many new and innovative ways of programming. Fibers are definitely also beneficial for microcontrollers. I can think of a few things that would make good use of Fibers: 1:

Re: Fibers and async io stuff for beginners

2015-04-23 Thread Jens Bauer via Digitalmars-d-learn
On Thursday, 23 April 2015 at 14:22:01 UTC, Ali Çehreli wrote: On 04/23/2015 06:56 AM, ref2401 wrote: http://ddili.org/ders/d.en/fibers.html I appreciate any feedback before the book is finally printed sometime before DConf. This is great information. I didn't know anything about F

Re: Fibers and async io stuff for beginners

2015-04-23 Thread ref2401 via Digitalmars-d-learn
Awesome!

Re: Fibers and async io stuff for beginners

2015-04-23 Thread Ali Çehreli via Digitalmars-d-learn
On 04/23/2015 06:56 AM, ref2401 wrote: I'm intrested in fibers and async io. Could anyone suggest articles, books or tutorials about the subject? Thank you I am working on adding a Fibers chapter to my book. Although it is still a draft and not linked from any other page, I've made

Fibers and async io stuff for beginners

2015-04-23 Thread ref2401 via Digitalmars-d-learn
I'm intrested in fibers and async io. Could anyone suggest articles, books or tutorials about the subject? Thank you

Re: fibers and ranges: what's wrong here?

2014-12-13 Thread Tobias Pankrath via Digitalmars-d-learn
On Saturday, 13 December 2014 at 12:26:49 UTC, zeljkog wrote: On 13.12.14 13:01, zeljkog wrote: void main() { auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]); auto tr1 = TreeRange(tt); foreach(v; tr1){ writef("%2d, ", v); } writeln(); for(auto r = TreeRange(tt); !r.em

Re: fibers and ranges: what's wrong here?

2014-12-13 Thread zeljkog via Digitalmars-d-learn
On 13.12.14 13:01, zeljkog wrote: void main() { auto tt = Tree(5, [Tree(7,[Tree(11), Tree(4)]), Tree(10)]); auto tr1 = TreeRange(tt); foreach(v; tr1){ writef("%2d, ", v); } writeln(); for(auto r = TreeRange(tt); !r.empty; r.popFront()) writef("%2d, ", r.front); wri

Re: fibers and ranges: what's wrong here?

2014-12-13 Thread Tobias Pankrath via Digitalmars-d-learn
When you assigning the worker in TreeRange, you create a delegate that captures the current TreeRange or 'this'. --- worker = new Fiber(&fiberFunc); --- foreach is defined as (http://dlang.org/statement.html#ForeachStatement): --- for (auto __r = range; !__r.empty; __r.popFront()) {

fibers and ranges: what's wrong here?

2014-12-13 Thread zeljkog via Digitalmars-d-learn
import std.stdio, core.thread; struct Tree{ int val; Tree[] tree; } struct TreeRange{ Tree curtree; bool empty; Fiber worker; this(Tree t){ worker = new Fiber(&fiberFunc); curtree = t; popFront(); } void fiberFunc(){ Tree t = curtree; Fiber.yield(); f

Re: Fibers

2014-09-17 Thread Vladimir Panteleev via Digitalmars-d-learn
work. Perhaps this example is oversimplified, but fibers won't help in doing some operation at the exact same time. They will still run sequentially, on a single CPU, as if no threads/fibers were used. I don't think there is a way to perform an operation in a truly atomic way on a di

Re: Fibers

2014-09-17 Thread Andrew Edwards via Digitalmars-d-learn
On 9/17/14, 9:43 PM, Kagamin wrote: fibs ~= new TestFiber(entry); should just work without accounting for number of items Kagamin/Flamencofantasy, thank you very much.

Re: Fibers

2014-09-17 Thread Kagamin via Digitalmars-d-learn
and fibs.length = count;

Re: Fibers

2014-09-17 Thread Kagamin via Digitalmars-d-learn
fibs ~= new TestFiber(entry); should just work without accounting for number of items

  1   2   >