using vibe listenHTTP in a library on OSX causes: core.sync.exception.SyncError@(0): Unable to lock mutex.

Timothee Cour thelastmammoth at gmail.com
Fri Dec 1 00:57:00 UTC 2017


on OSX 10.13.1 if that matters; IIRC it was working on previous OSX version.


On Thu, Nov 30, 2017 at 4:46 PM, Timothee Cour <thelastmammoth at gmail.com> wrote:
> I get: core.sync.exception.SyncError@(0): Unable to lock mutex.
> when calling listenHTTP via a library. It works when compiling
> everything in a single application without using intermediate library.
>
> details:
>
> using: dmd:2.077
>
> dub build
>
> dmd -ofmain -L-Ldir -L-ltest1 -Isource import/main.d
>
> ./main
> Listening for requests on http://[::1]:8080/
> Listening for requests on http://127.0.0.1:8080/
> Please open http://127.0.0.1:8080/ in your browser.
> core.sync.exception.SyncError@(0): Unable to lock mutex.
>
>
> source/app.d:
> ```
> void fun(){
> import vibe.vibe;
> auto settings = new HTTPServerSettings;
> settings.port = 8080;
> settings.bindAddresses = ["::1", "127.0.0.1"];
> static void hello(HTTPServerRequest req, HTTPServerResponse res){
>   res.writeBody("Hello, World!");
> }
> listenHTTP(settings, &hello);
> logInfo("Please open http://127.0.0.1:8080/ in your browser.");
> runApplication();
> }
> ```
>
> dub.json:
> ```
> {
> "name": "test1",
>   "targetType": "staticLibrary", // same with dynamicLibrary
>   "targetName": "test1",
>
> "dependencies": {
> "vibe-d": "==0.7.31",  // same with 0.8.1
> },
> "description": "...",
> "copyright": "...",
> "authors": ["..."],
> "license": "proprietary"
> }
> ```
>
> main.d:
> ```
> import app;
> void main(){
>   fun;
> }
> ```


More information about the Digitalmars-d mailing list