# What does config.threadsafe! actually do?

**URL:** <https://www.ruby-forum.com/t/what-does-config-threadsafe-actually-do/160015>\
**Category:** Rails\
**Created:** [February 10, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/what-does-config-threadsafe-actually-do/160015 "2009-02-10T23:39:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [February 10, 2009, 11:39pm UTC](https://www.ruby-forum.com/t/what-does-config-threadsafe-actually-do/160015/1 "2009-02-10T23:39:53Z")

</div>

Does anyone know what config.threadsafe! actually does, what effect(s)  
it has? I’m even sure where to go looking in the source code for  
effects of a config variable like that, but if someone has source to  
recommend, I’ll give it a shot (although I sometimes have trouble  
comprehending AR source, I must admit).

I know it tells Rails to do concurrency request handling. Okay, so far  
so good. But I suspect it does other things to to them make Rails behave  
differently to support concurrent request handling, rather than simply  
remove a mutex around the event loop or whatever.

I ask this because, while I’m not actually interested in concurrent  
request handling (don’t need it), I _do_ use threads in my Rails app for  
other purposes. (Dealing with long-running processes, dealing with  
talking to slow external web services). I’m actually surprised that  
nobody else seems to have a use case for this, but in my app it’s pretty  
crucial. So I’m trying to figure out what Rails 2.2 can do for me, and  
how I’ll have to change my Rails 2.1 code to deal with it, etc… The  
changes around supporting threading more intentionally are potentially  
good, but the only documentation or writing I can find on it (and very  
little of that) assumes you are interested in concurrent request  
handling.

Since I’m not, I don’t neccesarily want to call config.threadsafe!. But  
I’m wondering if there are side effects of config.threadsafe! that I  
might want to trigger myself, to make Rails happier about handling  
multiple threads (possibly with AR) even without concurrent request  
handling.

Anyone have any info to point me to?

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [February 11, 2009, 10:14am UTC](https://www.ruby-forum.com/t/what-does-config-threadsafe-actually-do/160015/2 "2009-02-11T10:14:19Z")

</div>

There is some good information right in the rails 2.2 release notes  
along with links to blogs with more information.

> **[Ruby on Rails 2.2 Release Notes — Ruby on Rails Guides](https://guides.rubyonrails.org/2_2_release_notes.html#_thread_safety)**
>
> Ruby on Rails 2.2 Release NotesRails 2.2 delivers several new and improved features. This list covers the major upgrades but doesn't include every little bug fix and change. If you want to see everything, check out the list of commits in the main...

Aaron

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [February 11, 2009, 4:54pm UTC](https://www.ruby-forum.com/t/what-does-config-threadsafe-actually-do/160015/3 "2009-02-11T16:54:02Z")

</div>

Aaron B. wrote:

> There is some good information right in the rails 2.2 release notes  
> along with links to blogs with more information.  
> [Ruby on Rails 2.2 Release Notes — Ruby on Rails Guides](http://guides.rubyonrails.org/2_2_release_notes.html#_thread_safety)

Thanks Aaron. I definitely checked that out before posting, but it (and  
it’s links) don’t have quite enough information for me. They don’t  
really say what config.threadsafe! _does_, except for allow concurrent  
request handling.

Guess I’ll have to dive into the source at some point.
