Re: using vibe listenHTTP in a library on OSX causes: core.sync.exception.SyncError@(0): Unable to lock mutex.
On 2017-12-01 01:46, Timothee Cour 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 Your example doesn't link since it doesn't link with vibe.d. -- /Jacob Carlborg
Re: using vibe listenHTTP in a library on OSX causes: core.sync.exception.SyncError@(0): Unable to lock mutex.
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 Courwrote: > 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, ); > 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; > } > ```
using vibe listenHTTP in a library on OSX causes: core.sync.exception.SyncError@(0): Unable to lock mutex.
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, ); 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; } ```