Announcement

Collapse
No announcement yet.

Queue Help vb.net

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Queue Help vb.net

    Hey guys,

    Im working on my plugin and i need a little help

    I have a Queue with objects that need to get processed.. I have a function that adds the items to the queue... But i want to know the best way to if Queue.Count > 0 do something

    I had a thread that would contuinious check the queue, but that is not the way to do it since it puts a load on the CPU.

    Second i had the thread goto sleep and once i called enqueue it would wake up the thread, process and then go back to sleep, but for something reason i think they may break if there is alot of activity in the queue or go into a deadlock state.

    I was wondering if there is a better method, i tried making an event but i dont quite know the syntax on making a custom event in vb.net VS2008, i feel this is the best way but i dont quite know how...

    Any ideas?

    Thanks

    -Tom-
    -Tom-

    #2
    I use a windows .net timer object to run a routine that checks the queue periodically. Every .1 seconds works for me.

    tenholde
    tenholde

    Comment


      #3
      For my LED Betabrite script package (Snevl_bb) I use .NET queues to manage messages sent to the sign. Each message is put on the sign for a user-defined time period, and I use the queues to stack them up if the user chooses to have lots of them.

      I use HS events to pop items off the queue until there are no more, at which point it reverts back to showing a default "idle" message that the user has set up.

      Anyway, I've had good luck with creating delayed trigger events to process things off the queue. I realize it is different / simpler than you might do in a plug-in, but... That's one of the reasons I've stayed away from plug-ins.

      Steve

      Comment

      Working...
      X