mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

#process

12 posts11 participants0 posts today

I finally eliminated the need for a dedicated #thread controlling the pam helper #process in #swad. 🥳

The building block that was still missing from #poser was a way to await some async I/O task performed on the main thread from a worker thread. So I added a class to allow exactly that. The naive implementation just signals the main thread to carry out the requested task and then waits on a #semaphore for completion, which of course blocks the worker thread.

Turns out we can actually do better, reaching similar functionality like e.g. #async / #await in C#: Release the worker thread to do other jobs while waiting. The key to this is user context switching support like offered by #POSIX-1.2001 #getcontext and friends. Unfortunately it was deprecated in POSIX-1.2008 without an obvious replacement (the docs basically say "use threads", which doesn't work for my scenario), but still lots of systems provide it, e.g. #FreeBSD, #NetBSD, #Linux (with #glibc) ...

The posercore lib now offers both implementations, prefering to use user context switching if available. It comes at a price: Every thread job now needs its private stack space (I allocated 64kiB there for now), and of course the switching takes some time as well, but that's very likely better than leaving a task idle waiting. And there's a restriction, resuming must still happen on the same thread that called the "await", so if this thread is currently busy, we have to wait a little bit longer. I still think it's a very nice solution. 😎

In any case, the code for the PAM credential checker module looks much cleaner now (the await "magic" happens on line 174):
github.com/Zirias/swad/blob/57

Continued thread

Found an issue and fixed it. Turns out destroying my #Process instance when the child exited was wrong, there could still be unread data in the #pipe. But then, only waiting for #EOF on the pipe was equally wrong ...

Now the code does the only reliable thing:

* When the child terminated, close the pipe for stdin immediately if one was present
* Only destroy the process instance once the child terminated AND the pipes for #stdout and #stderr (IF they were present) found EOF.

Committed now:
github.com/Zirias/poser/commit

And here are the docs:
zirias.github.io/poser/api/lat

My testing code also had to change a bit and now makes for a completely pointless and cute wrapper around /bin/ls 🙈 😂

On a #coding mission to improve my #poser lib 😎.

In the current implementation of #swad, I don't really like that I need an extra thread, just to control a child #process. A first piece to add to poser is generic "child process support", which I'm testing right now. I realized I could reuse my #Connection class, which was built for #sockets, but works just as well with #pipes 🙃

TODO now is mostly testing. See screenshots for some mimimal testing code and its output ... would you like this kind of interface? 🤔

I'm reposting everything from my old Instagram, to keep my archive and have a record of my work's development. I'm adding commentary below the original text.

This is from 2 July 2019
Adding the ink drops to the shaggy mane ink caps. They are nearly done, just a bit of painting and detailing the base to do. I will show them lit up very soon!
Silicone can't be painted - but I created a recipe for a paint that does stick to cured silicone! It's made out of... silicone 😂
Music: Walk by @iksonofficial

It’s been a little while since I last posted - things get busy!
Video isn’t really my forte (yet?), but I’m considering starting a video channel. That would mean learning editing and figuring out a video setup… which I don’t really have time for at the moment.
Still, maybe! It could be a nice way to show more of my process.

#wip #process