Use correct type for constant in JIT
Add rb_mutex_* methods to C-API.

Also setup a NativeMethodFrame for the finalizer, because it might end
up in a C extension needing to make a C API handle.
Add thread safety to OpenSSL gem

With OpenSSL, you need to register some methods to make sure OpenSSL is
thread safe to use. Since we don't want to lock around the whole
extension, we make sure to setup this stuff.
Add specs for rb_mutex_* C-API methods
Fix rb_mutex_unlock spec for return value
Fix a race condition when joining a C-API created thread

We weren't calling setup on a thread created with the C-API, which
resulted in the @joins array not being setup properly. By ensuring to
send setup, we have the same setup as a Ruby thread so it works
properly.
Use spinlocks over object lock in method table

We need to lock around reads of the method table as well, and with
object locks we need access to the call frame because it might GC in the
mean while. Changing this is tricky, since it also affects for example
the JIT which doesn't have these structures.

Therefore this switches it to a spinlock, because there are no GC paths
necessary in the method table and this way we can lock around it
properly for reads as well.
NKF extension is not thread safe, lock around it

The NKF extensions uses global state extensively internally. This puts a
lock around this so it's not as problematic anymore.

We should replace this in the future with optional per extension C-API
locks so we can keep a list of thread unsafe extensions and lock for
those specifically.

Fixes #2310