views:

42

answers:

2

As mentioned in this question, autoloading within a thread can cause problems. What work-arounds can be applied?

A: 

You could roll your own with a const_missing plus a Mutex.

Konstantin Haase
+1  A: 

You can simply require the files containing the classes you need, before spawning threads. It is a bit more work to get running than simply using autorequires, but it is necessary here.

That way you avoid having a class being loaded on multiple threads due to racing conditions.

laust.rud