AnsweredAssumed Answered

vrf Threads just stop

Question asked by bwalden on Jun 20, 2005
So, with a little help from my vfr friends, I was able to solve the
referenced problem. For what its worth, here's what I did wrong, why I
did it and how I fixed it:

My application allows some number of UDP ports to be configured to
receive data.  The incoming data is expected to begin with a sequence of
characters that constitute an identifier. When data arrives at a port,
the event driven code extracts the 1st group of characters and uses it
as the name of a global variable which it then sets to the value of
entire input string.

This works perfectly until an input error occurs and the code attempts
to use an illegal variable name. In order to prevent this from stopping
the application, I passed the variable name and the intended value to a
function that contained nothing but a "Set" object. Using a function in
this manner allowed trapping "bad variable name" errors in the event
service code. Unfortunately, I only provided one function for all the
UDP input event threads to share. Apparently, given a few hours, this
led to a "race" condition which stopped many (but not all) of the
application threads. Everything looked fine but very little was being done.

I fixed the situation by providing a separate "Set" function for each of
the UDP input event threads. The application has been running for two
days now without a problem - about 10 msgs per second spread over 3 UDP

I'm somewhat of a slow learner - I've made this same mistake in the
past. It comes from believing what I've read about functions running to
conclusion once they have been called. Apparently event driven functions
don't work this way - it appears that you don't want to allow event
driven code to share functions with any other threads; primary
application threads or other event code threads.


You are currently subscribed to vrf as:
To subscribe send a blank email to "".
To unsubscribe send a blank email to "".
To send messages to this mailing list,  email "". 
If you need help with the mailing list send a message to "".