Questions tagged [fibers]

A fiber is a lightweight thread which uses cooperative rather than preemptive multitasking. It is very similar to and often confused with a [coroutine]. Use this tag for questions relating to the [ruby] feature, otherwise prefer to use [coroutine].

A fiber is a lightweight thread which uses cooperative rather than preemptive multitasking. It is very similar to and often confused with a .

In Ruby, fibers are primitives for implementing light weight cooperative concurrency. It appeared in Ruby 1.9.

Related tags

189 questions
4
votes
0 answers

Errors when trying to install node fibers

I'm trying to install node fibers for use with my Meteor app on a Windows server that does not have an internet connection. I've manually copied the fibers files from github to the programs/server/node_modules/fibers directory as per the package…
illya
  • 377
  • 5
  • 17
3
votes
1 answer

What to do after quitting in the middle of a fiber

Once I am done in the middle of a Fiber instance fiber, i.e., I yielded from it without completing it, and I am not using fiber any more, what should I do with it? Should I explicitly destroy it, or is there something like kill for a Fiber, or will…
sawa
  • 165,429
  • 45
  • 277
  • 381
3
votes
1 answer

Ruby Fibers and faye

I have simple script with EventMachine, Fibers and faye require "faye" require "em-synchrony" require "hiredis" require 'redis' require 'redis/connection/synchrony' faye = Faye::Client.new 'http://localhost:9292/faye' redis =…
Falcon
  • 1,461
  • 3
  • 15
  • 29
3
votes
2 answers

Ruby 3 collecting results from multiple scheduled fibers

Ruby 3 introduced Fiber.schedule to dispatch async tasks concurrently. Similar to what's being asked in this question (which is about threaded concurrency) I would like a way to start multiple concurrent tasks on the fiber scheduler and once they…
Erik Madsen
  • 1,913
  • 3
  • 20
  • 34
3
votes
1 answer

PHP fiber waits until finish which i don't want to wait

I want to create a thread using Fiber (PHP 8.1) to send an email (email sending takes 10 seconds, so I decide to use a thread for it). And this is my code
HelloMachine
  • 355
  • 2
  • 8
3
votes
1 answer

C fibers crashing on printf

I am in the process of creating a fiber threading system in C, following https://graphitemaster.github.io/fibers/ . I have a function to set and restore context, and what i am trying to accomplish is launching a function as a fiber with its own…
wild-ptr
  • 100
  • 6
3
votes
1 answer

ruby has nothing like a Fiber.kill?

I'm using Fibers to handle scheduling between different chunks of code, and this has proven to be massively simpler than trying to manage Threads since my use case is fairly simple (and involves only running one script at a time). Unfortunately I…
3
votes
2 answers

Detect Project Loom technology as missing or present JVM at runtime

Project Loom is now available in special early-release builds of Java 16. If I were to run my Loom-based app on a Java implementation lacking in the Project Loom technology, is there a way to detect that gracefully early in my app launching? I want…
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
3
votes
0 answers

Is cancelation required when Fiber fails?

What is the proper behavior to avoid resource/memory leak? Is it required/correct to cancel failed Fiber? val someEffect: F[Unit] = //... def someFiber[F[_]: MonadError[?[_], Throwable]](fa: F[Fiber[F, Unit]]): F[Unit] = for { fiber <- fa …
Some Name
  • 8,555
  • 5
  • 27
  • 77
3
votes
1 answer

Stackful coroutines + gdb = "previous frame inner to this frame (corrupt stack)?"

I'm writing some code to debug stackful coroutines that use Boost.Context's make_fcontext and jump_fcontext, and have run into a small problem. Normally it is not possible to backtrace past the entry of a stackful coroutine as it executes on its own…
Filipp
  • 1,843
  • 12
  • 26
3
votes
2 answers

What will happen if not call yield in fiber?

As I understand from docs yield() function is passing control to another fiber. What will happen if we will not call yield in fiber in D? Will it's mean that thread will hang? Or I am wrong understand that fibers works inside threads and they work…
Dmitry Bubnenkov
  • 9,415
  • 19
  • 85
  • 145
3
votes
0 answers

Meteor: issue in building. Error Cannot find module 'fibers'

We have a meteor application. It is being built using the command meteor build . Now, I extract the tar.gz created from the above step and go till the main.js location. Now when I execute node main.js, it gives the following…
Megha Dev
  • 180
  • 1
  • 12
3
votes
1 answer

Self Hosted Meteor App Fibers Issue

Good Morning I've have this issue for the last few days and I'm really frustrated with the lack of support/documentation. My error is below: /usr/share/nginx/html/bundle/programs/server/node_modules/fibers/future.js:245 …
user2330898
  • 253
  • 2
  • 12
3
votes
1 answer

Implementing preemptive microthreads using signal handlers and setjmp/longjmp

I want to implement POSIX compliant microthreads in Linux environment. Basic idea is as follows: Using technique described here, assign new stack space for each fiber. Using setitimer, create timer that will send signals in constant time interval.…
monkey
  • 103
  • 1
  • 6
3
votes
1 answer

Waking up by push notification

Suppose: There is some object (e.g., an array a) and a condition dependent on the object (e.g., such as a.empty?). Some threads other than the current thread can manipulate the object (a), so the truthness of the evaluated value of the condition…
sawa
  • 165,429
  • 45
  • 277
  • 381
1 2
3
12 13