On 2/12/23 1:01 PM, Steve wrote:
On Sunday, 12 February 2023 at 15:24:14 UTC, Steven Schveighoffer wrote:
Any synchronous calls will just be synchronous. They aren't going to participate in the async i/o that vibe uses.

In other words, when you block on a call to sqlite, it will block everything else in your web server until that completes.



Would this be the correct approach to stop it blocking?:
```d
auto result = async(&doSqliteStuff, args...).getResult();
```

That might work, depending on args. As documented in the API, if anything in args are mutable references, then it is run as a task, and the same problem still applies (it will use a fiber, and count on the concurrency of vibe's fibers to deal with the asynchronicity).

If it is possible, it will run in a worker thread, and then it can execute concurrently.

I believe you can do:

isWeaklyIsolated!(typeof(args))

to see if it will run in another thread.

I admit not having any experience with this function.

-Steve

Reply via email to