Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: boost::mute...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 16 of 16 Topic 43970 of 48417
Post > Topic >>

Re: boost::mutex - are lock attempts queued?

by Lars Uffmann <aral@[EMAIL PROTECTED] > Mar 19, 2008 at 02:19 PM

Szabolcs Ferenczi wrote:
> The workaround is that you explain what you want to achieve and we can
> help you coming up with a thread compliant design for your problem.

I think Paavo came up with what I need to do.

I'm trying to access two different types of data with two different 
threads: master thread = GUI (wxWidgets) event handlers, child thread = 
continuous boost::thread network traffic handler.

The master thread shall be able to signal the child thread to terminate, 
that makes up one of the data types I need to access there: a keepalive 
flag for the thread (or boost::condition, in the future). The other type 
of data is GUI controls, upon which wxWidgets holds a lock (of its own 
type) while any event handler is running, and the child thread can only 
access these for reading or writing when no GUI event handler is active.

So a possible timeline goes like (* = child thread running, x = event 
handler):

x  disable child thread status control on GUI
x  change GUI status control to "stop child thread"
x  start child thread (button event handler)
x* end event handler
  * enable child thread status control on GUI
  * handle network traffic until user clicks a button to end child thread
  * ...
  * (user presses button "end child thread")
x* disable child thread status control on GUI
x* change GUI status control to "start child thread"
x* signal child thread to exit
x* send a predefined packet to get child thread out of listening mode
x* end event handler
  * end current network servicing loop
  * enable child thread status control on GUI
  * end child thread

All the time, the child thread will update status indicators on the GUI, 
which can only be accessed while no event handler is running.

Best Regards,

   Lars
 




 16 Posts in Topic:
boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 15:36:14 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 15:53:19 
Re: boost::mutex - are lock attempts queued?
Joe Greer <jgreer@[EMA  2008-03-18 17:27:54 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 17:42:09 
Re: boost::mutex - are lock attempts queued?
Lionel B <me@[EMAIL PR  2008-03-18 15:27:11 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 16:50:24 
Re: boost::mutex - are lock attempts queued?
Lionel B <me@[EMAIL PR  2008-03-18 16:02:54 
Re: boost::mutex - are lock attempts queued?
ytrembla@[EMAIL PROTECTED  2008-04-01 16:45:59 
Re: boost::mutex - are lock attempts queued?
Fei Liu <fei.liu@[EMAI  2008-03-18 11:29:08 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-18 16:53:37 
Re: boost::mutex - are lock attempts queued?
Paavo Helde <nobody@[E  2008-03-18 14:22:56 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-19 14:08:12 
Re: boost::mutex - are lock attempts queued?
Gerhard Fiedler <gelis  2008-03-19 10:43:46 
Re: boost::mutex - are lock attempts queued?
ytrembla@[EMAIL PROTECTED  2008-04-01 16:52:09 
Re: boost::mutex - are lock attempts queued?
Szabolcs Ferenczi <sza  2008-03-18 15:44:28 
Re: boost::mutex - are lock attempts queued?
Lars Uffmann <aral@[EM  2008-03-19 14:19:49 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 9:46:31 CST 2008.