Skip to content

Instantly share code, notes, and snippets.

View voddan's full-sized avatar

Daniil Vodopian voddan

  • Saint-Petersburg, Russia
View GitHub Profile
@chriseidhof
chriseidhof / goroutines.swift
Created February 16, 2018 12:36
goroutines.swift
import Foundation
protocol Channel: IteratorProtocol {
func send(_ value: Element?)
}
/// A blocking channel for sending values.
///
/// `send` and `receive` must run in separate separate execution contexts, otherwise you get a deadlock.
final class BlockingChannel<A>: Channel {
public class Test {
private static class A {
private int bar;
private A() {
bar = 3;
System.out.println(getBar());
}
public int getBar() {
return bar;