Welcome to the Linux Foundation Forum!

Linux analog to Apple’s io.activity

Options

Greetings all. New member here, with 25 years of Linux development experience.

I’m working on a large Swift library, porting it from MacOS to Linux. The only piece I have left is a critical component that employs Apple’s os.activity library. It’s unfortunate the original authors chose that approach, but here we are.

The software uses os.activity to obtain unique task (thread?) identifiers and use them as keys into a table maintaining “contexts” bound to each task. The Apple library supports this so that the identifiers don’t need to be passed around to other code areas. Very nice, but it was written to support os.log, not for the way it’s used in the library I’m porting.

Does anyone know of a Linux analog to os.activity? I’m presently looking at the user context API, as well as pthreads. The rub here is that Swift’s support for await() calls - asynchronous behavior - allows “tasks” to cross thread boundaries. Thus, just using a thread ID is apparently insufficient.

Thanks very much! Cheers.

Categories

Upcoming Training