# OpenSSL Locks

**URL:** <https://www.ruby-forum.com/t/openssl-locks/238007>\
**Category:** NGINX\
**Created:** [December 11, 2013, 11:55am UTC](https://www.ruby-forum.com/t/openssl-locks/238007 "2013-12-11T11:55:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [December 11, 2013, 11:55am UTC](https://www.ruby-forum.com/t/openssl-locks/238007/1 "2013-12-11T11:55:58Z")

</div>

I need to do some additional processing with OpenSSL in a custom  
module. I noticed ngingx does not set any locks in ngx\_ssl\_init (from  
ngx\_event\_openssl.c).

A few questions:

1. Should lock installation be guarded on NGX\_THREADS or something else?

2. Where is most appropirate to initialize the locks: ngx\_init\_threads  
or ngx\_ssl\_init (or somewhere else)?

3. Is the project interested in a patch? (Per  
[Contributing Changes](http://nginx.org/en/docs/contributing_changes.html), thanks Maxim).

Thanks in advance.

Jeff

---

<div class="post-metadata">

**Author:** ![Jeffrey\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jeffrey\_W](https://www.ruby-forum.com/u/Jeffrey_W)\
**Post date:** [December 11, 2013, 4:25pm UTC](https://www.ruby-forum.com/t/openssl-locks/238007/2 "2013-12-11T16:25:18Z")

</div>

Hello!

On Wed, Dec 11, 2013 at 05:55:16AM -0500, Jeffrey W. wrote:

> 1. Is the project interested in a patch? (Per  
> [Contributing Changes](http://nginx.org/en/docs/contributing_changes.html), thanks Maxim).

There are basically no threads support in nginx (it was  
experimental and broken for a long time with the exception of some  
win32-related stuff), so it’s not clear why you need locks at all.

–  
Maxim D.  
[http://nginx.org/](http://nginx.org/)

---

<div class="post-metadata">

**Author:** ![Jeffrey\_W](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/6f9a4e/32.png) [@Jeffrey\_W](https://www.ruby-forum.com/u/Jeffrey_W)\
**Post date:** [December 11, 2013, 4:42pm UTC](https://www.ruby-forum.com/t/openssl-locks/238007/3 "2013-12-11T16:42:50Z")

</div>

On Wed, Dec 11, 2013 at 10:25 AM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > 1. Should lock installation be guarded on NGX\_THREADS or something else?
> > 
> > 2. Where is most appropirate to initialize the locks: ngx\_init\_threads  
> > or ngx\_ssl\_init (or somewhere else)?
> > 
> > 3. Is the project interested in a patch? (Per  
> > [Contributing Changes](http://nginx.org/en/docs/contributing_changes.html), thanks Maxim).
> 
> There are basically no threads support in nginx (it was  
> experimental and broken for a long time with the exception of some  
> win32-related stuff), so it’s not clear why you need locks at all.  
> Thanks Maxim. The source code is full of:

```
#if (NGX_THREADS)
  ...
#endif

```

I thought they were needed. My bad.

Jeff
