Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
import "time"
import "runtime"
func main() {
numcpu := runtime.NumCPU()
-module(tr).
-compile([export_all]).
-define(PRIORITIES, [high, med, low]).
next_priority(high) ->
med;
next_priority(med) ->
low;
-module(tr).
-compile([export_all]).
proc1() ->
timer:sleep(1000),
receive
{high, M} ->
io:format("~p~n", [M])
after
0 ->
process_file(StatusFileName, Table) ->
FileName = ?STATUS_FILES_DIR ++ StatusFileName,
{ok, IoD} = file:open(FileName, read),
HttpURL = io:get_line(IoD, ''),
file:close(IoD),
{ok, {{_Version, 200, ReasonPhrase}, _Headers, _Body}} = httpc:request(HttpURL),
file:delete(FileName),
ets:insert(Table, {StatusFileName, -1}).
do_process() ->