Results 1 to 2 of 2

Thread: Multithreading with vb safe?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2009
    Posts
    113

    Multithreading with vb safe?

    I run some code. it downloads a file then scans the text for certain keywords. It works fine with no threads.

    I add threads to make it faster, so in each new thread a new download is started and the file is scanned using regex.

    So if I set max num of threads to 5 at any one time there could be 5 downloads simultaneously.

    What I found is that with 5 max threads after a while the pc starts makes bleeping noises from the box (not speakers)

    Why is this. Normallly it is due to the GPU overheating. But the vb program harldy uses any graphics. So is it due to too many downloads or something im doing wrong? I did notice the grpx card temps go upto 60 degress but this cant be due to the program could it? If I run it on one or two thread it never has this problem

    All downloads are run using httpwebrequest and all scans using regular expressions. All threads are run in the background and this is the code:

    Code:

    Code:
            Dim wc As New txtscan()
            wc.threadurl = url
    
            AddHandler wc.Scan_Finished, AddressOf Scan_FinishedEventHandler
            AddHandler wc.Scan_Update, AddressOf Scan_UpdateEventHandler
    
            Dim newthread As New System.Threading.Thread(AddressOf wc.getwords)
            newthread.IsBackground = True
            newthread.Priority = My.Settings.threadpriority
            activethreads += 1
            newthread.Start()
    Any help is appreciated.

  2. #2
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Multithreading with vb safe?

    Do some logging to the output window or something like that - see what's really going on for thread creation and completion.

    I do that.

    I actually code my backend services with UI's at first so I can pop into the UI thread and fill nice listboxes and such with run stats.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width