Great post and paclet! Glad someone else found my code useful! I know how to make the function that will not block the kernel.
- To do this you would have to create an asynchronous task directly on the C side, but then the very idea of writing a server only in a top-level language is already broken.
- You could just make the server run by default on a parallel kernel with ParallelSubmit/LinkCreate and return a task that can be stop the server if it necessary.
– you have earned Featured Contributor Badge ![]()
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
Yes, these are both good approaches. I also came to the conclusion that, in general, there is no escaping writing C code (or something like it) for launching asynchronous tasks.
As for ParallelSubmit etc., I did get an example working with LocalSubmit, though it took a bit of finagling. You can find it under the scope section here: https://resources.wolframcloud.com/PacletRepository/resources/ChristopherWolfram/WebServer
I also had problems killing the LocalSubmitted task, or getting it to share variables with the main kernel, which sort of defeats the purpose.
I think you can use LinkCreate to
- Exchange data with the parallel kernel via WSTP
- To have a possibility to stop the process completely
But then in this case there will be a big overhead related to work via WSTP, so there are some disadvantages here too. In fact, I thought over many variants when I was writing my implementation and came to the conclusion that minimalistic C implementation will be the most efficient.