Re: Am I doing this right?



Hello Buc,

Is there somereason you dont just push the data direct to the DB? What's the Queue for?

-Boo

I have an simple app that pulls UDP socket packets off a network,
places
that packet data in a structure, and places the structure into a
vb.net
Queue (use enqueue. and dequeue). Writes queue to SQL server
In the form I have global decl.
PUBLIC DataQueue as NEW QUEUE
PUBLIC STRUCTURE myDataStruct (add some elements)
In my ONRECEIVEI place the buffer data into myDataStruct and
DataQueue.Enqueue(myDataStruct).

I also have a 100ms timer that does this:
dim tmpStruct as NEW myDataStruct
tmpStruct = DataQueue.Dequeue()
write tmpStruct to SQL
I've got a bool flag in the timer routine to keep it from running
again
until it finishes everthing
Is there any kind of conflict that can occur here?
If OnReceive fires and enqueues while timer is dequeueing?
Some sort of deadlock???
I debug.writeline when enqueueing to assure what goes in the queue,
but
sometimes when I dequeue the data it has a value from another packet
(scrambled), though the enqueue showed fine. Happens rarely but does
happen.
I don't quite understand how the OS executes the code, reading and
writing
at what 'I guess' is the same time to that queue sometimes.
Is the scenerio above OK to use or is there a better solution (more
stable)
than what I am doing?
Thanks
BUC


.



Relevant Pages

  • Re: How to evaluate an expression using Queue?
    ... but I need to use Queue structure. ... done; dequeue and return it. ... calculate the result and enqueue it in B, ... become a single value in A, with B empty; and that will satisfy the ...
    (comp.programming)
  • RE: Threading Issue
    ... one might have multiple threads ... Thread-safe Enqueue and Dequeue methods (worker threads enqueue, ... Dequeue is a function returning Object. ... your main thread could just poll the queue. ...
    (microsoft.public.dotnet.languages.vb)
  • Am I doing this right?
    ... that packet data in a structure, and places the structure into a vb.net ... Queue (use enqueue. ... dim tmpStruct as NEW myDataStruct ... though the enqueue showed fine. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: [PATCH 1/2] NET: Multiple queue network device support
    ... dev->queue_lock would block multiqueue devices in that same ... identical to the already existing enqueue logic. ... the existing branch if multi queue is not enabled. ... drivers implement the subqueue API just to be able to lock the queues. ...
    (Linux-Kernel)
  • RE: [PATCH 1/2] NET: Multiple queue network device support
    ... Subject: NET: Multiple queue network device support ... repsonsible to acquire the lock for qdisc_restart. ... lock queue 1, and enqueue the packet. ... queue checked in dequeue for an skb, so I cannot rely on that lock ...
    (Linux-Kernel)