Re: Prevents Events From Interrupting Events



jehugaleahsa@xxxxxxxxx wrote:
I got away from another thread by having events manage the download
process. In other words, I have an event set the next file to
download.

That doesn't answer the question. Just having an event or an event handler does not in and of itself avoid the use of a thread. In fact, in many scenarios events are implemented as a way for a thread to easily execute code that needs to execute when certain things happen in that thread.

I am starting to think, however, that I should create another thread
to handle the downloading. This will help reduce some of the
complexity of overlapping event handlers and booleans.

Adding another thread will also add to the complexity of your design. Since your design already has a deadlock condition as it is, I would be surprised if you can fix that basic design issue by adding a new thread and you could easily just make it harder to fix.

Thanks for your response. By the way . . . is it possible for the same
thread to deadlock itself with the help of events? or is the lock
keyword ignored when it is the same thread?

Thread synchronization isn't ignored when it occurs multiple times in the same thread. However, it is nested without any problem or potential for a thread deadlocking itself. So within the same thread, you can use the lock() statement or similar synchronization mechanism multiple times without any trouble.

For the best answers, you should put together a concise-but-complete example of code that reliably reproduces the problem you're having and post that here. Without that, it's very difficult to comment intelligently on the specifics of your design and how you would best avoid the deadlock issue.

Pete
.



Relevant Pages

  • Re: Thread synchronization problem
    ... > the design is supposed to satisfy. ... When I ask to download a Datas object, I download only the list of names, ... When I ask to download a Data object, the information is retrieved from the ... I checked whether the data was empty every time I accessed ...
    (comp.lang.java.programmer)
  • Re: [Rubyinstaller-devel] One-Click Ruby Installer needs a new home, can you help him?
    ... I think that hosting a web site (as opposed a download site) is not ... downloads, but provide a better, simplified and clean access to Ruby ... Simple, clean, friendly design. ...
    (comp.lang.ruby)
  • Re: How much text on a page?
    ... allows people to sample a story without having to download the entire ... There is also a bit of future-proofing in my design. ... I recognise that HTML generators will probably not produce ... "WYSIWYG" mode then you may want to look for a newsgroup dedicated to ...
    (uk.net.web.authoring)
  • Re: [ofa-general] Re: Demand paging for memory regions
    ... you could do this without a new chip design in general. ... Lot's of RDMA ... host memory so they are already designed to hang onto packets during ... pages and then putting the storage over IB would be deadlock ...
    (Linux-Kernel)
  • Xilinx 3E design programs fine with 500E but fails with 250E
    ... Ive got a design that uses the spartan XC3S500E, ... and a .MCS (which works correctly when you download it direct to the ... it fails to program the external M25P80 SPI flash ... SPI access core not detected. ...
    (comp.arch.fpga)

Loading