Sha256: 0882582a00c8720eeb144b40931e9ca5d651a2190b051683486a9396c776cd95

Contents?: true

Size: 679 Bytes

Versions: 7

Compression:

Stored size: 679 Bytes

Contents

# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2017-2022, by Samuel Williams.

require_relative 'generic'
require_relative 'thread'

module Async
	module Container
		# A multi-thread container which uses {Thread.fork}.
		class Threaded < Generic
			# Indicates that this is not a multi-process container.
			def self.multiprocess?
				false
			end
			
			# Start a named child thread and execute the provided block in it.
			# @parameter name [String] The name (title) of the child process.
			# @parameter block [Proc] The block to execute in the child process.
			def start(name, &block)
				Thread.fork(name: name, &block)
			end
		end
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
async-container-0.18.3 lib/async/container/threaded.rb
async-container-0.18.2 lib/async/container/threaded.rb
async-container-0.18.1 lib/async/container/threaded.rb
async-container-0.18.0 lib/async/container/threaded.rb
async-container-0.17.1 lib/async/container/threaded.rb
async-container-0.17.0 lib/async/container/threaded.rb
async-container-0.16.13 lib/async/container/threaded.rb