[erlang-questions] A async c driver issues: The emulator will be halted during the execution of c driver code.
Chris Newcombe
chris.newcombe@REDACTED
Wed Apr 2 20:35:24 CEST 2008
> I worte a c driver for parsing xml pieces. The driver works , but when the
> c driver invoked , the erlang emulator will be halted until the execution
> of c driver completed.
One way around this would be to use the latest release of EDTK (Erlang
Driver Toolkit).
http://www.snookles.com/erlang/edtk/
(For an overview read
http://www.snookles.com/erlang/edtk/pli2002-edtk-paper.pdf and then
look at the README files in the tarball.)
When enhancing EDTK to support Berkeley DB I added the ability to call
the wrapped C code from a private thread pool, so it won't block the
Erlang VM. This was essential for using Berkeley DB as that library
frequently blocks caller threads on database page locks, and also does
blocking disk IO.
The learning curve may appear steeper at first, as you have to learn
how to write an XML file that declares your API. But there are a lot
of docs and examples, and once you get past the initial bump it is
quite flexible and powerful. e.g. BDB is a big, complex library and
EDTK can now handle almost all of its features.
One caveat: EDTK only runs on Linux and Solaris at the moment. I know
some folks are close to having an Mac OS X port running. I don't know
of anyone porting it to Windows yet.
I hope this helps,
Chris
More information about the erlang-questions
mailing list