Welcome Guest, Not a member yet? Register   Sign In
CI Singleton - Thread Safe? - benchmark as example
#1

[eluser]Unknown[/eluser]
All,

I'm new to the CI framework, and need some quick info regarding the CI singleton. In short, is the following code thread safe?

Code:
$CI =& get_instance();
$CI->benchmark->mark('mark1') ;
// Do something
$CI->benchmark->mark('mark1') ;

I need access to the CI instance in my helpers, but the helpers will most certainly be accessed at the same time by multiple threads. As I noted above, I'm new to CI, and I'm making a lot of assumptions here, including that get_instance() returns a singleton.

So, is benchmark on CI thread safe? What about declaring other items on CI, such as the following?

Code:
$CI->load->library('simplexml') ;

Many thanks.

Lukas




Theme © iAndrew 2016 - Forum software by © MyBB