Browse files

use lock on comiler, erlc is not reentrant

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@377 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent 1a88429 commit 9550a4047fe49e19b7344daa9ab85cfca54e64dc @klacke committed Apr 9, 2003
Showing with 21 additions and 12 deletions.
  1. +21 −12 src/yaws_compile.erl
View
33 src/yaws_compile.erl
@@ -48,18 +48,27 @@ comp_opts(GC) ->
compile_file(File, GC, SC) ->
- ?Debug("Compile ~s~n", [File]),
- case file_open(File) of
- {ok, Fd} ->
- Spec = compile_file(#comp{infile = File,
- infd = Fd, gc = GC, sc = SC},
- 1,
- get_line(), init, 0, [], 0),
- Spec;
- _Err ->
- yaws:elog("can't open ~s~n", [File]),
- exit(normal)
- end.
+ %% broken erlang comppiler isn't
+ %% reentrant, can only have one erlanf compiler at a time running
+ global:trans({yaws, self()},
+ fun() ->
+ ?Debug("Compile ~s~n", [File]),
+ case file_open(File) of
+ {ok, Fd} ->
+ Spec = compile_file(
+ #comp{infile = File,
+ infd = Fd, gc = GC, sc = SC},
+ 1,
+ get_line(), init, 0, [], 0),
+ Spec;
+ _Err ->
+ yaws:elog("can't open ~s~n", [File]),
+ exit(normal)
+ end
+ end,
+ [node()], infinity).
+
+
compile_file(C, _LineNo, eof, aftererl, NumChars, Ack, Errors) ->
file_close(C#comp.infd),

0 comments on commit 9550a40

Please sign in to comment.