Semaphore implementation in rust taken from the previously deprecated std-semaphore
If you have two threads, executing the following:
| Thread A | Thread B |
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
defmodule Store do | |
use GenServer | |
def start_link(state \\ [:foo]) do | |
GenServer.start_link(__MODULE__, state, name: __MODULE__) | |
end | |
def init(state), do: {:ok, state} | |
def get, do: GenServer.call(__MODULE__, :get) |
defmodule Store do | |
use GenServer | |
def start_link(state \\ [:foo]) do | |
GenServer.start_link(__MODULE__, state, name: __MODULE__) | |
end | |
def init(state) do | |
:ets.new(:store, [:named_table]) | |
:ets.insert(:store, {:key, state}) |
defmodule Store do | |
def get do | |
[:foo] | |
end | |
end |
Semaphore implementation in rust taken from the previously deprecated std-semaphore
If you have two threads, executing the following:
| Thread A | Thread B |
This post on StackExchange Code Review is the basis for this algorithm.
Oh no! Commander Lambda's latest experiment to improve the efficiency of her LAMBCHOP doomsday device has backfired spectacularly. She had been improving the structure of the ion flux converter tree, but something went terribly wrong and the flux chains exploded. Some of the ion flux converters survived the explosion intact, but others had their position labels blasted off. She's having her henchmen rebuild the ion flux converter tree by hand, but you think you can do it much more quickly - quickly enough, perhaps, to earn a promotion! >