How not to post ( was thread-safe timer for C++ callback )

This is a discussion on How not to post ( was thread-safe timer for C++ callback ) within the General Discussions forums, part of the Community Boards category; In a unix pthreads based app I'm working on, I have objects of a particular class (call it class foo) ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    5

    How not to post ( was thread-safe timer for C++ callback )

    In a unix pthreads based app I'm working on, I have objects of a particular class (call it class foo) being created in multiple threads. I need a specific public method of class foo invoked at or after 60 seconds of the object coming into existence (it is not imperative that it happens at precisely 60s, just that it happens at either 60s or very shortly thereafter).

    Any ideas on what thread-safe timers are available that could I use to achieve this? Looking for either something that I could just drop right in to my class foo or which I could derive from.
    Last edited by aj17; 03-07-2011 at 08:29 PM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    Meanwhile, back at the ranch....
    thread-safe timer for C++ callback - C++

    Choosing where (and when) to post.
    How To Ask Questions The Smart Way
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    5
    Quote Originally Posted by Salem View Post
    Meanwhile, back at the ranch....
    thread-safe timer for C++ callback - C++

    Choosing where (and when) to post.
    How To Ask Questions The Smart Way
    Back at the ranch, dear sherlock, my question has actually garnered some decent suggestions. So... anyone reading my question here, pls head over there if you're interested.

    The same question posted here attracted nothing more than your helpful little post. Did I do well in posting the question here + elsewhere? Hmm, that's a tough one...

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Quote Originally Posted by aj17 View Post
    Back at the ranch, dear sherlock, my question has actually garnered some decent suggestions. So... anyone reading my question here, pls head over there if you're interested.

    The same question posted here attracted nothing more than your helpful little post. Did I do well in posting the question here + elsewhere? Hmm, that's a tough one...
    People here enjoy helping others solve their problems. We do not enjoy solving their problems for them. As you can see, the people at this forum have put the same amount of effort into this problem as you have.
    bit∙hub [bit-huhb] n. A source and destination for information.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    5
    Quote Originally Posted by bithub View Post
    People here enjoy helping others solve their problems. We do not enjoy solving their problems for them. As you can see, the people at this forum have put the same amount of effort into this problem as you have.
    Negative. I did not ask anyone to solve my problem. I stated my problem and asked for ideas on what timers people were aware of that might be suitable for me to use in solving my problem. If you don't know of any, it's perfectly ok to not reply.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,915
    Quote Originally Posted by aj17 View Post
    Back at the ranch, dear sherlock, my question has actually garnered some decent suggestions. So... anyone reading my question here, pls head over there if you're interested.

    The same question posted here attracted nothing more than your helpful little post. Did I do well in posting the question here + elsewhere? Hmm, that's a tough one...
    This attitude will not get you answers.
    Cross-posting is a bad thing, and that was what Salem wanted to point out.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    No, all you managed was to alienate a bunch of people with your selfish "Hey, this thread is really important".

    Here's a thought experiment for you.
    Imagine a world where selfish cross-posting is endemic, to the point that every single post appears on every single forum. What possible motivation would there be for any response, knowing full well that someone, somewhere would have said exactly the same thing. The result is that everyone with a question spams like there is no tomorrow just in the hope that they strike lucky. The whole system breaks down.

    You post on ONE forum, you wait patiently for replies. If you don't get replies or you can't get a good answer, THEN you move onto the next forum, possibly leaving a nice trail for others to follow up on.

    But anyway, since you just want an argument, and not a technical discussion, this is moved and closed.

    No, all you managed was to alienate a bunch of people with your selfish "Hey, this thread is really important".

    Here's a thought experiment for you.
    Imagine a world where selfish cross-posting is endemic, to the point that every single post appears on every single forum. What possible motivation would there be for any response, knowing full well that someone, somewhere would have said exactly the same thing. The result is that everyone with a question spams like there is no tomorrow just in the hope that they strike lucky. The whole system breaks down.

    You post on ONE forum, you wait patiently for replies. If you don't get replies or you can't get a good answer, THEN you move onto the next forum, possibly leaving a nice trail for others to follow up on.

    But anyway, since you just want an argument, and not a technical discussion, this is moved and closed.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Post your games here...
    By Hammer in forum Game Programming
    Replies: 132
    Last Post: 02-28-2013, 09:29 AM
  2. Replies: 1
    Last Post: 06-25-2010, 08:14 AM
  3. SIGALRM and timer
    By nkhambal in forum C Programming
    Replies: 1
    Last Post: 06-30-2008, 01:23 AM
  4. brace-enclosed error
    By jdc18 in forum C++ Programming
    Replies: 53
    Last Post: 05-03-2007, 06:49 PM
  5. How to make a thread sleep or std::recv timeout?
    By BrianK in forum Linux Programming
    Replies: 3
    Last Post: 02-26-2003, 10:27 PM

Tags for this Thread


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