Re: [Cppcms-users] Booster thread id
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2014-10-12 07:22:07
|
Hello, This is good question and I have a good answer for that. The C++11 and boost::thread::id provide order, output and hash operators i.e. <, ==, cout << and so on. Under windows it is actually straight forward to implement thread id as the ID is actually a windows HANDLE (basically pointer) Under POSIX operating systems like Linux, Solaris, BSD pthread_t exact type is undefined it may be integer or structure. The only promise is that you can compare them with pthread_equal. So you can't properly create thread_id that has same meaning as OS thread_id. So you can query it for various system properties (i.e. check if it is joinable etc) Boost solves this using various tricks like generation of counters on the fly, TLS and so on. So even if I add boost::thread::id it would have operators == and != as per posix semantics. As it really have very low added value and very hard to implement properly if you want just to print the id you can use std::this_thread::get_id() and std::thread::id under C++11 or their boost variants. Artyom Beilis -------------- CppCMS - C++ Web Framework: http://cppcms.com/ CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ >________________________________ > From: Nhân Lê Đức <nh...@gm...> >To: cpp...@li... >Sent: Saturday, October 11, 2014 6:23 PM >Subject: Re: [Cppcms-users] Booster thread id > > > >Marcel, I got your point. >I hope I can explain more detail later by using CppCMS in real use case. >This question is just my wonder when in an cppcms::application main, >I add code print current thread id. Then make few request by opening many tabs, >console logs out a bunch of thread ids. I think oh, application_pool automatically >creates instances of application. Number of threads in my process rise, >even close tabs this number does not decrease. I know that principle applications will be >returned to the pool. But how to know a thread is busy, or idle or hang, etc. >I think Does CppCMS has built-in to monitor this or I have to create such facility by my own? >I still in very first experience with CppCMS but I believe CppCMS is great in it's design. >Please keep moving forward and keep in touch. > > >Cheers, >Nhan > >------------------------------------------------------------------------------ >Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer >Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports >Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper >Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer >http://p.sf.net/sfu/Zoho > >_______________________________________________ >Cppcms-users mailing list >Cpp...@li... >https://lists.sourceforge.net/lists/listinfo/cppcms-users > > > |