#include <boost/thread/once.hpp>
#include <boost/thread/tss.hpp>
#include <boost/thread/future.hpp>
+#include <boost/thread/pthread/pthread_helpers.hpp>
+#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
#ifdef __GLIBC__
#include <sys/sysinfo.h>
#include <unistd.h>
#endif
-#if defined(__VXWORKS__)
+#if defined(__VXWORKS__)
#include <vxCpuLib.h>
-#endif
+#endif
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/trim.hpp>
i->second->unlock();
i->first->notify_all();
}
+//#ifndef BOOST_NO_EXCEPTIONS
for (async_states_t::iterator i = async_states_.begin(), e = async_states_.end();
i != e; ++i)
{
(*i)->notify_deferred();
}
+//#endif
}
struct thread_exit_callback_node
= thread_info->tss_data.begin();
if(current->second.func && (current->second.value!=0))
{
- (*current->second.func)(current->second.value);
+ (*current->second.caller)(current->second.func,current->second.value);
}
thread_info->tss_data.erase(current);
}
boost::detail::thread_data_base* get_current_thread_data()
{
- boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
+ boost::call_once(current_thread_tls_init_flag,&create_current_thread_tls_key);
return (boost::detail::thread_data_base*)pthread_getspecific(current_thread_tls_key);
}
~externally_launched_thread() {
BOOST_ASSERT(notify.empty());
notify.clear();
+//#ifndef BOOST_NO_EXCEPTIONS
BOOST_ASSERT(async_states_.empty());
async_states_.clear();
+//#endif
}
void run()
{}
# elif defined(BOOST_HAS_PTHREAD_YIELD)
BOOST_VERIFY(!pthread_yield());
//# elif defined BOOST_THREAD_USES_DATETIME
-// xtime xt;
+// ::boost::xtime xt;
// xtime_get(&xt, TIME_UTC_);
// sleep(xt);
// sleep_for(chrono::milliseconds(0));
mutex mx;
unique_lock<mutex> lock(mx);
condition_variable cond;
- cond.do_wait_until(lock, detail::internal_platform_clock::now())
+ cond.do_wait_until(lock, detail::internal_platform_clock::now());
# endif
}
}
set &= set -1;
}
return(i);
- #else
+ #else
return (__builtin_popcount(set) );
- #endif
+ #endif
#elif defined(__GLIBC__)
return get_nprocs();
#else
if(local_thread_info->current_cond)
{
boost::pthread::pthread_mutex_scoped_lock internal_lock(local_thread_info->cond_mutex);
- BOOST_VERIFY(!pthread_cond_broadcast(local_thread_info->current_cond));
+ BOOST_VERIFY(!posix::pthread_cond_broadcast(local_thread_info->current_cond));
}
}
}
}
void add_new_tss_node(void const* key,
- boost::shared_ptr<tss_cleanup_function> func,
+ detail::tss_data_node::cleanup_caller_t caller,
+ detail::tss_data_node::cleanup_func_t func,
void* tss_data)
{
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
- current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(func,tss_data)));
+ current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(caller,func,tss_data)));
}
void erase_tss_node(void const* key)
}
void set_tss_data(void const* key,
- boost::shared_ptr<tss_cleanup_function> func,
+ detail::tss_data_node::cleanup_caller_t caller,
+ detail::tss_data_node::cleanup_func_t func,
void* tss_data,bool cleanup_existing)
{
if(tss_data_node* const current_node=find_tss_data(key))
{
if(cleanup_existing && current_node->func && (current_node->value!=0))
{
- (*current_node->func)(current_node->value);
+ (*current_node->caller)(current_node->func,current_node->value);
}
if(func || (tss_data!=0))
{
+ current_node->caller=caller;
current_node->func=func;
current_node->value=tss_data;
}
}
else if(func || (tss_data!=0))
{
- add_new_tss_node(key,func,tss_data);
+ add_new_tss_node(key,caller,func,tss_data);
}
}
}
current_thread_data->notify_all_at_thread_exit(&cond, lk.release());
}
}
+
+//#ifndef BOOST_NO_EXCEPTIONS
namespace detail {
void BOOST_THREAD_DECL make_ready_at_thread_exit(shared_ptr<shared_state_base> as)
}
}
}
-
+//#endif
}