Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Libthread is in. Also: halp!


So, I've landed libthread in the base distribution, and (in theory) made
libstd thread safe. There wasn't much to do -- three bits of shared state
in all of libstd.

The API is pretty bare bones at the moment -- you can launch a thread, and you
can use mutexes, but I expect that it will grow to something relatively useful
over time, as threaded programs get written and needed APIs.

As far as the help goes, I'm having trouble figuring out how to do mutexes on
OSX. The syscalls to handle the kernel side of things are woefully
undocumented, and I'm having trouble sorting out how to use them effectively,
which means that mutexes on OSX are shitty sleep-and-spin locks.

The system calls I'm trying to figure out are the psynch family of calls,
implemented in the kernel here:

	https://opensource.apple.com/source/libpthread/libpthread-105.1.4/kern/kern_synch.c

And used from userspace here:

	https://opensource.apple.com/source/libpthread/libpthread-105.1.4/src/pthread_mutex.c

There's a suggestive comment on __mtx_droplock, but if I can get someone who
knows more about this concurrency stuff that can point or help explain
what's going on, I'd really appreciate it.

Other than that: Progress!

-- 
    Ori Bernstein