Browse files

Got examples into Makefile and ensured that chronos does not block on…

… synchronous calls.
  • Loading branch information...
1 parent 3329067 commit b77a9274272030dc35f45ecc519baa87798b6d2c Torben Hoffmann committed Feb 23, 2012
Showing with 11 additions and 118 deletions.
  1. +8 −117 Makefile
  2. +3 −1 src/chronos.erl
View
125 Makefile
@@ -1,121 +1,12 @@
-#REBAR = ./rebar
-REBAR = rebar
-DIALYZER = dialyzer
-CT_RUN = ct_run
-TOUCH = touch
-.PHONY: all deps compile escripize clean doc testclean eunit ct test release \
- devrelease_config devrelease devclean devconsole devconsole_clean \
- run plt analyze get-deps compile-deps distclean ct_setup tags \
- rebuild-yaws ct_run
+build:
+ sinan build
-all: deps compile
+example_beams: examples/*.erl
-tags:
- find . -name "*.[he]rl" -print | etags -
+examples: build example_beams
+ erlc -o examples examples/*.erl
-deps: get-deps compile-deps
-
-compile:
- @$(REBAR) compile skip_deps=true
-
-escriptize:
- @$(REBAR) escriptize
-
-clean: testclean
- @$(REBAR) clean
- @rm -f test/*.beam erl_crash.dump ./deps/.compile-deps
- @find . -name app.config -exec rm -f {} \;
-
-#distclean: clean
-# @rm -fr apps/payment/logs
-
-testclean:
- @rm -fr Mnesia.nonode\@nohost
- @rm -fr test/*.beam
-
-eunit: compile testclean
- @$(REBAR) skip_deps=true eunit
-
-test_build:
- erlc -I include -o test test/*.erl
-
-test_console:
- erl -pa deps/*/ebin -pa ebin -pa test
-
-ct_setup:
- mkdir -p logs
-
-CWD = $(shell pwd)
-ct_run:
- erl -noshell \
- -pa deps/*/ebin -pa apps/*/ebin \
- -sname ct \
- -env TEST_DIR test \
- -include ${CWD}/apps/payment/include \
- -spec backend-api.spec \
- -config backend-api.sys.config \
- -dir test \
- -s ct_run script_start -s erlang halt > logs/raw.log 2>&1
-
-ct: ct_setup deps compile testclean ct_run
- sh ./test_ct_run.sh
-
-test: ct
-
-release: deps compile
- @rm -fr release/backend-api
- (cd release && ../rebar generate)
-
-devrelease_config:
- @mkdir -p release/vars
- @cp release/vars.config release/vars/devrelease_vars.config
-
-devrelease: deps compile devclean
- @mkdir -p dev
- (cd release \
- && ../rebar generate target_dir=../dev/$@ overlay_vars=vars/$@_vars.config)
-
-devclean:
- @rm -fr dev
-
-devconsole:
- ./dev/devrelease/bin/backend-api console \
- -pa ../../apps/payment/ebin \
- -pa ../../deps/meck/ebin
-
-devconsole_clean:
- ./dev/devrelease/bin/backend-api console_clean \
- -pa ../../apps/payment/ebin \
- -pa ../../deps/meck/ebin
-
-run: release
- release/backend-api/bin/backend-api console
-
-rebuild-yaws:
- @echo 'Rebuilding some yaws beams with debug info'
- erlc +debug_info -I deps/yaws/include -o deps/yaws/ebin deps/yaws/src/*.erl
-
-plt: rebuild-yaws
- $(DIALYZER) --build_plt --output_plt .backend-api.plt \
- -pa deps/*/ebin \
- deps/*/ebin \
- --apps kernel stdlib sasl inets crypto \
- public_key ssl mnesia runtime_tools erts \
- compiler tools syntax_tools xmerl hipe webtool
-
-analyze: compile
- $(DIALYZER) --no_check_plt \
- apps/*/ebin \
- --plt .backend-api.plt \
- -Werror_handling \
- -Wunmatched_returns #-Wunderspecs
-
-docs:
- @$(REBAR) doc skip_deps=true
-
-get-deps:
- @$(REBAR) get-deps
-
-compile-deps:
- @$(REBAR) compile
+PROJ_PATH=-pa /apps/erlang/r14b4/lib/kernel-2.14.5/ebin -pa /apps/erlang/r14b4/lib/stdlib-1.17.5/ebin -pa /apps/erlang/r14b4/lib/compiler-4.7.5/ebin -pa /Users/th/Library/Erlang/lib/proper-1.0/ebin -pa /apps/erlang/r14b4/lib/eunit-2.2.1/ebin -pa /Users/th/git_repos/chronos/_build/chronos/lib/chronos-0.0.1/ebin
+ex_shell:
+ erl -pz examples ${PROJ_PATH}
View
4 src/chronos.erl
@@ -115,7 +115,9 @@ handle_info({timeout, TRef, {Timer, {M, F, Args}}}, #chronos_state{running=R}=St
NewR =
case lists:keytake(Timer, 1, R) of
{value, {_,TRef}, R1} ->
- erlang:apply(M, F, Args),
+ spawn( fun() ->
+ erlang:apply(M, F, Args)
+ end ),
R1;
{value, _, R1} -> %% has to ignore since TRef is not the current one
R1;

0 comments on commit b77a927

Please sign in to comment.