Thread timer

This is a discussion on Thread timer within the C Programming forums, part of the General Programming Boards category; Hi all, is there a method to use threads to set up a timer for a long time(about 8 hours)? ...

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    72

    Thread timer

    Hi all,

    is there a method to use threads to set up a timer for a long time(about 8 hours)? Thanks for your help.

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    Can't you just implement a normal timer (google this) and start that in a new thread and when it has elapsed you do something?

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    72
    Thanks shakti, i googled a lot for it but nothing? give me a link or better a sample .

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    I won't give a sample but depending on what you need you probably want to look into the functions and data-structures provided by time.h for inspiration on how a simple timer can be built. It really all depends on how you expect to use it..do you just want a timer that times how fast a piece of code executes or do you want to use the timer to idle the program, what precision do you need and so on.

  5. #5
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,652
    5 minutes (at MOST!) of Google is "a lot"? Puhleeze!

  6. #6
    Registered User
    Join Date
    Feb 2010
    Posts
    72
    Thanks, but i need a clear answer!!! thanks for the help and effort.

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    We have answered you! You need to show some effort, we will not do your entire work!

  8. #8
    Registered User
    Join Date
    Feb 2010
    Posts
    72
    ??!! i'm not asking for doing something, i'm just asking for a link or an idea (some PSEUDO CODE) not a working code! it's amazing that when people know something don't share it with other! When i logged to this forum the first thing i do is to see if there a question that i can answer if so i do my best to give the answer and it's the responsability of the person who ask the question to see if this manner is good for his knowledge or it's better for him to post and post again and again to better understand.

    thanks for those who spend their time trying to help others on this forum without asking any questions.

  9. #9
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    But this is so trivial a mere 5 minutes on google will help you (the first 6 results to to c+timer pretty much gives you all the info you need).

    A part of becoming a good programmer is being able to find and extract information from documentation and references without somebody holding your hand. This is why you sometimes are met with answers like these, simply because they are so trivial that a mere search and some reading would do.

  10. #10
    Registered User
    Join Date
    Feb 2010
    Posts
    72
    It's may be a trivial thing for you but not for me, it's the reason why i'm asking. Any way thanks for your time.

    Thanks.

  11. #11
    Registered User
    Join Date
    Aug 2003
    Posts
    1,208
    Then make an attempt and ask specific questions about specific problems you have. You need to show some effort to get some back.

  12. #12
    Registered User
    Join Date
    Feb 2010
    Posts
    72
    That's what i want thanks , topic is now closed, great answer, and amazing philosophy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Listening socket and thread problem
    By esaptonor in forum Windows Programming
    Replies: 6
    Last Post: 06-19-2010, 03:04 AM
  2. Terminating secondary thread from another thread
    By wssoh85 in forum C++ Programming
    Replies: 13
    Last Post: 12-19-2008, 04:14 AM
  3. Thread Prog in C language (seg fault)
    By kumars in forum C Programming
    Replies: 22
    Last Post: 10-09-2008, 01:17 PM
  4. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  5. Replies: 12
    Last Post: 05-17-2003, 05:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21