NetTalk Central

Author Topic: Help 4 Newbies - Session Queue, what it looks like  (Read 4549 times)

MyBrainIsFull

  • Full Member
  • ***
  • Posts: 134
    • View Profile
Help 4 Newbies - Session Queue, what it looks like
« on: September 15, 2014, 03:48:01 AM »
I know Bruce dosent like this, but I find it useful for development

Ever wondered what the session Q looks like?
Wonder if you can access parent table data from your child form?
Made a session Q variable and it dosent work for you?

This lets you put the session Q on the window of the server so you can see them all
I used Web25.app (attached)  to let you see how to put it there with only a few changes

Now I am not saying ship your apps like this

But for development or learning its ok

attached is a screen shot of the server window showing the session queue for the child form of web25, it has scroll bars as it can get way long...


If you want to do it for yourself, look in the app attached
In the server, I made a local "SessionQ"  with name and value
I dropped a list on the window, fed from this Q, and formatted the list box for the 2 fields
Made a Routine in the source "BuildSessionQ Routine"
and fed it from the event where the log Q is updated.


-*-*-*-*-*-*  NOTE, since writing this, I noticed it was not updating on the event, but after it
 So, move the   do buildsessionq    a few lines down in the WebServer to the bottom of
ThisWebServer.TakeEvent  PROCEDURE
- - - - - - - -






[attachment deleted by admin]
« Last Edit: October 15, 2014, 01:37:57 AM by MyBrainIsFull »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Help 4 Newbies - Session Queue, what it looks like
« Reply #1 on: October 21, 2014, 04:28:27 AM »
>> I know Bruce doesn't like this ...

Be aware that the session queue is used by multiple threads, and so access to the queue has to be managed with a CriticalSection. Thus it is not possible to simple display the actual session data queue on the window. You can copy the contents to a queue of your own (for displaying on the window) but when copying the data across be sure to use the critical section to block access to the queue while making the copy.

ThisWebServer._Wait()
! copy the contents of the queue
ThisWebServer._Release()

Because this process "blocks" the other threads, it is quite "expensive" from a performance point of view. Thus while you may find it useful while learning, it should not be used in any sort of production system or performance will likely be very hampered. Also be aware that you are viewing a copy of the queue, not the queue itself, so you may need to refresh the copy from time to time.

cheers
Bruce