NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: kevin plummer on August 30, 2009, 11:44:56 PM

Title: Using Queues
Post by: kevin plummer on August 30, 2009, 11:44:56 PM
Hi All,

I know I am not allowed to use Queues in my NTWS program (and have seen the strange results by doing so!). However I drill into a lot of my existing windows program functions and it is going to be a big job to convert them all to use the In-Memory file driver. I was doing some research in the help docs and not sure if I was to make the queue static and threaded if that would solve my problems or what other problems this would then cause me?


"The THREAD attribute on a QUEUE declaration declares a static QUEUE data buffer which is allocated memory separately for each execution thread in the program. This makes the values contained in the QUEUE dependent upon which thread is executing. Whenever a new execution thread is begun, a new instance of the QUEUE, specific to that thread, is created."

Title: Re: Using Queues
Post by: Bruce on August 31, 2009, 06:24:57 AM
Hi Kevin,

making it Threaded would cause it to be empty on just about all the WebServer threads.
so that's out.

you can make it static - but then you need to work carefully with critical sections to make sure it's not used similtaneously by 2 threads. But this is tricky, get it just a little bit wrong and your program will regularly "hang".

cheers
Bruce
Title: Re: Using Queues
Post by: kevin plummer on August 31, 2009, 03:16:22 PM
Thanks - Memory Tables it is then!