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. Prepare for extremely stupid question!

Prepare for extremely stupid question!

Scheduled Pinned Locked Moved Visual Basic
questioncsharpc++
2 Posts 2 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.
  • M Offline
    M Offline
    Matt Philmon
    wrote on last edited by
    #1

    Ok. I'm a C++ programmer (with a little VB6 experience) that's recently started using VB.NET quite a bit. I have to ask this even though I feel pretty certain that I don't have to worry about it... but I'm not sure just how large the changes are from VB to VB.NET so here we go... In VB.NET, if I use multiple Timer objects (the new one, not the Forms one) so I can have different times, is there any chance the timers could fire at the same time? Ie, VB.NET is still basically a single threaded application, right? Each run of a fired timer event will NOT be treated as a thread...? I'm just making sure. I'm thinking of doing something a certain way and some of the resources used in each timer are shared so I can't have them stepping on each other. Would another timer fire off while another one is running? Can I stop that behavior (if it exists) with some sort of locking mechanism like a Mutex in C++?

    P 1 Reply Last reply
    0
    • M Matt Philmon

      Ok. I'm a C++ programmer (with a little VB6 experience) that's recently started using VB.NET quite a bit. I have to ask this even though I feel pretty certain that I don't have to worry about it... but I'm not sure just how large the changes are from VB to VB.NET so here we go... In VB.NET, if I use multiple Timer objects (the new one, not the Forms one) so I can have different times, is there any chance the timers could fire at the same time? Ie, VB.NET is still basically a single threaded application, right? Each run of a fired timer event will NOT be treated as a thread...? I'm just making sure. I'm thinking of doing something a certain way and some of the resources used in each timer are shared so I can't have them stepping on each other. Would another timer fire off while another one is running? Can I stop that behavior (if it exists) with some sort of locking mechanism like a Mutex in C++?

      P Offline
      P Offline
      Pete Bassett
      wrote on last edited by
      #2

      Are you talking about the System.threading.Timer? If so, you should have a look at the MSDN regarding them. I just read this. Use a TimerCallback delegate to specify the methods associated with a Timer. The methods do not execute in the thread that created the timer; they execute in a separate thread that is automatically allocated by the system If you're talking about the System.Timers.Timer then you're also in trouble Note The event-handling method may be called even after the Stop method is called. The event-handling method may run on one thread at the same time that a call to the Stop method runs on another thread. This might result in the Elapsed event being raised even after the Stop method is called. To prevent this, use the SignalTime property to compare the time the event was raised to the time the Stop method was called. If the event was raised after the Stop method was called, do not process the event. Pete
      Pete


      Insert Sig. Here!

      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