Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Threading

Threading

Scheduled Pinned Locked Moved Visual Basic
helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    V 2
    wrote on last edited by
    #1

    Hi, I wanna use threading in my application for doing this i used this code Me.thread1 = New Threading.Thread(AddressOf Me.process1) Me.thread2 = New Threading.Thread(AddressOf Me.process2) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.thread1.Priority = ThreadPriority.Highest Me.thread2.Priority = ThreadPriority.Highest Me.thread2.Start() Me.thread1.Start() End Sub But The problem is that when one process is completed then other process is started while i wanna start both process simultaneously... How can i do this i have searched in google but nothing find benificial Thanks with anticipation

    Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

    T P 2 Replies Last reply
    0
    • V V 2

      Hi, I wanna use threading in my application for doing this i used this code Me.thread1 = New Threading.Thread(AddressOf Me.process1) Me.thread2 = New Threading.Thread(AddressOf Me.process2) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.thread1.Priority = ThreadPriority.Highest Me.thread2.Priority = ThreadPriority.Highest Me.thread2.Start() Me.thread1.Start() End Sub But The problem is that when one process is completed then other process is started while i wanna start both process simultaneously... How can i do this i have searched in google but nothing find benificial Thanks with anticipation

      Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

      T Offline
      T Offline
      Tony Richards
      wrote on last edited by
      #2

      I can't see anything wrong with this bit of code. Try calling Thread.Sleep in one or both of the Threads and see what happens. This makes the Thread give way to other operations for a certain amount of time before continuing. Also, remember that unless you have multiple CPUs, a computer only ever appears to be doing multiple things at once, but instead only does one thing at a time, rapidly switching between tasks to give the illusion of multitasking. It might just be that Windows' task scheduling ends up with them being executed on at a time. You could also try lowering the Priority of both the Threads. Do they really need to have Highest priority? Tony

      1 Reply Last reply
      0
      • V V 2

        Hi, I wanna use threading in my application for doing this i used this code Me.thread1 = New Threading.Thread(AddressOf Me.process1) Me.thread2 = New Threading.Thread(AddressOf Me.process2) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Me.thread1.Priority = ThreadPriority.Highest Me.thread2.Priority = ThreadPriority.Highest Me.thread2.Start() Me.thread1.Start() End Sub But The problem is that when one process is completed then other process is started while i wanna start both process simultaneously... How can i do this i have searched in google but nothing find benificial Thanks with anticipation

        Unless u don't give ur hundred percent whatever u r doing till there is no result of ur work...

        P Offline
        P Offline
        Paul Conrad
        wrote on last edited by
        #3

        The code looks fine, how are you sure they are not starting at the same time?

        "The clue train passed his station without stopping." - John Simmons / outlaw programmer "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon "Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups