|
Boost Users : |
Subject: Re: [Boost-users] passing variables into thread
From: Alexander Carôt (alexander_carot_at_[hidden])
Date: 2016-09-03 06:07:57
Hello all,
I have a thrad function like:
void sj::eventTrigger(){
boost::mutex::scoped_lock lock(eventTriggerMutex);
while (eventTriggerActive){
dFC->eventTriggerLock.wait(lock);
/// do something with pointer-variable
}
}
This function is executed by a eventTriggerLock.notify_all() – call from other objects and when I need to pass certain variables into the thread I have been unsing a global pointer variable.
Now my question:
I wonder if there is a way to get rid of the pointer variable and directly pass variables into the thread such as:
eventTriggerLock.notify_all(data1)
void sj::eventTrigger(int data1){
boost::mutex::scoped_lock lock(eventTriggerMutex);
while (eventTriggerActive){
dFC->eventTriggerLock.wait(lock);
/// do something with data1
}
}
Any hint welcome – thanks in advance
Alex
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net