예제 #1
0
파일: ossl.c 프로젝트: dennyc/openssl
static void
ossl_lock_unlock(int mode, struct CRYPTO_dynlock_value *l)
{
    if (mode & CRYPTO_LOCK) {
	/* TODO: rb_nativethread_id_t is not necessarily compared with ==. */
	rb_nativethread_id_t tid = rb_nativethread_self();
	if (l->count && l->owner == tid) {
	    l->count++;
	    return;
	}
	rb_nativethread_lock_lock(&l->lock);
	l->owner = tid;
	l->count = 1;
    } else {
	if (!--l->count)
	    rb_nativethread_lock_unlock(&l->lock);
    }
}
예제 #2
0
파일: ossl.c 프로젝트: Danylyuk/first_app
static unsigned long ossl_thread_id(void)
{
    /* before OpenSSL 1.0, this is 'unsigned long' */
    return (unsigned long)rb_nativethread_self();
}
예제 #3
0
파일: ossl.c 프로젝트: Danylyuk/first_app
static void ossl_threadid_func(CRYPTO_THREADID *id)
{
    /* register native thread id */
    CRYPTO_THREADID_set_pointer(id, (void *)rb_nativethread_self());
}