Pthread_cond_timedwait() returning ETIMEDOUT too soon?

I have two threads in my program. I would like the thread containing main() to spawn a new thread to perform a complicated task for up to five minutes, but kill it if it takes too long. I've been trying to accomplish this with a pthread_cond_timedwait, but it seems that this function can sometimes return ETIMEDOUT after no where near the correct amount of time has elapsed. A post at http://dbforums.com/showthread.php?t=769084 suggests that this might be caused by an hourly NTP synchronization changing the system clock time and invalidating the waiting timer. Is there any good way to work around this issue, or to handle a thread timing out more intelligently?

Probably the simplest way to use threads on Solaris is to use pthreads -- it's a portable thread interface that is the same on nearly all operating systems.
To use pthreads in C or C++ using Sun compilers, include <pthread.h> in your code, add the option -mt to every command line, and add -lpthread to each link command.
The full power of Solaris threads is not available via the pthread interface, but pthread is often all you need.
For more information, consult the C++ Users Guide, the Solaris man pages related to threads and pthreads.
Books on the topic are also available. ACCU has an extensive list of reviewed books. Here is a review of a book about pthreads:
http://accu.org/index.php/book_reviews?url=view.xqy?review=p002088

Similar Messages

  • HTMLLoader fires complete event too soon ?

    Hi to all,
    I have following problem i`m displaying pdf in a nativewindow (pdf is around 5 mb so i guess it takes some time to be rendered) I want to show user some custom progress bar until pdf is prepared to be shown in htmlLoader.The problem is that Event.COMPLETE is being dispatched too soon, pdf is not prepared to be shown.I tried with HTML_DOM_INITIALIZE event but same thing happened.
    I don`t want users to see empty window, i want to either progress bar or fully loaded PDF be shown.
    I figure out some workaround : i will download file from the location and open it up with openWithDefaultApplication() option within AIR 2, but i want to now if i can do it the way i wanted at the first place.
    Am i doing something wrong or there is some problem with HTMLLoader ?
    Here is simple code:
    htmlLoader.location = url;
    htmlLoader.addEventListener(Event.COMPLETE,onLoad);
    onLoad (...)
    //hide progress bar

    Dmennenoh, pulling the playSound function out of the other functions worked perfectly!  I should have known better.  Even though everything is working correctly I am now recieving an error stating that "Parameter url must be non-null."  I'm certain this has to do with the sound file urls that I am passing from the xml document... but if the sounds are playing the urls must be non-null already.
    I tried changing the tl["snd"+i] to container_mc["snd"+i] as you suggested but the sounds would not play at that point.  I recieve an error saying: "a term is undefined and has no porperties."  Below is how I built it:
    function buildScroller():void{
         for (var i:Number = 0; i < 55; i++){
            //create movie clips
            var container_mc:container = new container();
            addChild(container_mc);
            container_mc.x = 325 * i;  // set the number here to the width of the movie clip being repeated
            //sound info
            container_mc["snd"+i] = new Sound();       
            container_mc["snd"+i].load(new URLRequest(xmlData.sound.loc[i]));
            container_mc.snd = container_mc["snd"+i];
            container_mc.addEventListener(MouseEvent.CLICK, playSound, false, 0, true);
    function playSound(event:MouseEvent):void {
         event.currentTarget.container_mc.play();

  • Why the battery of iphone 5s  be decharged too soon?

    why the battery of iphone 5s  be decharged too soon?

    Perhaps these suggestions will help:
    http://www.apple.com/batteries/iphone.html
    also
    http://theweek.com/article/index/250098/ios-7-battery-life-6-simple-ways-to-keep -your-iphone-powered-up
    http://www.tuaw.com/2013/09/18/how-to-stop-ios-7-from-destroying-your-iphones-ba ttery-life/
    One final unconfirmed possibility:
    http://ipadnerds.com/fix-battery-drain-issue-ios-7/
    Regards.

  • Response message closes too soon.

    The response message to submitting my form closes too soon. Can I make it stay open or extend the time. Thanks, Roy www.royernst.com

    I have taken care of it. Thanks
    Roy Ernst, Ph. D., L. L. D.
    New Horizons Music, Founder and Advisor to the Board of Directors
    Professor Emeritus, Eastman School of Music of the University of Rochester
    [email protected]

  • Mac OS X 10.7 Recovery OS used too soon after enabling FiileVault 2

    For reference only
    http://pastebin.com/Jy6RvBXf
    If you use Recovery OS Disk Utility, or any comparable utility, too soon after enabling FileVault 2 — before entering a passphrase at the EFI loginwindow — then without a prompt to unlock the volume, an attempt to verify or repair may produce a report such as the one below.
    Verifying volume “a”
    Checking storage systemChecking volume.
    disk1: Scan for Volume Headers
    Invalid Volume Header @ 0: incorrect block type
    Invalid Volume Header @ 58855587328: invalid field value
    disk1 is not a CoreStorage volume
    Error: Storage system verify or repair failed.
    Also, the required startup volume may not be listed for startup purposes. 
    In this situation: do not be alarmed by the report.
    Restart the system. At the EFI loginwindow, which should appear within seconds of the startup chime, enter the passphrase.

    Step one is to ensure that you have a bootable backup/clone or a verified Time Machine backup of 10.7.3.
    Step two is to manually download and install the 10.7.3 COMBO update.
    Step three, if these are successful, is to manually download and install the 10.7.4 COMBO update, repair permissions, and restart.
    These should fix the problem with the installer. As for the games, i've not a clue since I don't run any on my computers.

  • [svn:osmf:] 14812: Fix bug where setting a resource a second time on a VideoElement caused an RTE due to the loadStateChange event listener being unregistered too soon .

    Revision: 14812
    Revision: 14812
    Author:   [email protected]
    Date:     2010-03-17 09:02:11 -0700 (Wed, 17 Mar 2010)
    Log Message:
    Fix bug where setting a resource a second time on a VideoElement caused an RTE due to the loadStateChange event listener being unregistered too soon.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/media/LoadableElementBase.as

    Revision: 14812
    Revision: 14812
    Author:   [email protected]
    Date:     2010-03-17 09:02:11 -0700 (Wed, 17 Mar 2010)
    Log Message:
    Fix bug where setting a resource a second time on a VideoElement caused an RTE due to the loadStateChange event listener being unregistered too soon.
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/media/LoadableElementBase.as

  • [svn:osmf:] 15456: Fix bug FM-707: Nested SerialElements signaling complete too soon.

    Revision: 15456
    Revision: 15456
    Author:   [email protected]
    Date:     2010-04-15 14:53:59 -0700 (Thu, 15 Apr 2010)
    Log Message:
    Fix bug FM-707: Nested SerialElements signaling complete too soon.
    Ticket Links:
        http://bugs.adobe.com/jira/browse/FM-707
    Modified Paths:
        osmf/trunk/framework/OSMF/org/osmf/elements/compositeClasses/CompositeTimeTrait.as
        osmf/trunk/framework/OSMFTest/org/osmf/elements/TestSerialElementWithTimeTrait.as

  • Internet Connect comes up too soon - fix?

    Whenever I restart (using Airport)Internet Connect software comes on before top title bar is loaded, so sees no connection. How to stop it loading too soon. I'm not sure that is problem. I've gone into Airport top menu, open Internet connect and have checked to "remember password in keychain" and it doesn't. I also have opened Airport Utility, and manually put in settings to remember password, but nothing works. I have to keep going into that airport menu top title bar, chooose my network and enter my password.
    -How to keep password there?
    -How to stop airport connect popping open before whole desktop is loaded, maybe that's problem?
    -?Any other ideas? Thanks!

    BD: I went back to terminal (copy/paste your words)to not show hidden files, now all of a sudden I have several new items on my desktop, and some I'm not sure are safe to remove, as looks like items that were in finder, and now are on desktop. Do you know why, and if safe to remove the following:
    Network (rt click choice to "eject" -but hope this won't messup network settings; no "move to trash" avail)
    .localized (can rt click to "move to trash, but will it harm anything?)
    .DS_Store ( can rt click to "move to trash, but will it harm anything?)
    ...and even icon showing my FileVault-ed home folder!(the only real rt-click choice for this is "force quit" and I hope it won't mess up all to do that!)
    PLEASE tell me if it's safe to do what the choices are, and if you know why this happened ..ie: what part of that script I put in for: showing hidden files, then reverting to hiding hidden files, caused this to happen?
    THANKS AHEAD for HELP!
    Message was edited by: Strgzr

  • Ntp service depends on dns but is started too soon

    Given servers defined in /etc/inet/ntp.conf, the service starts interactively (svcadm enable ntp) with an initial ntpdate call to set the clock.
    However, this fails on boot up as the servers are not found unless defined in /etc/inet/hosts. As a consequence, there can be a significant initial offset from the RTC, which corrupts the clock drift value and takes hours longer to stabilise.
    This implies that the ntp service is being started too soon before dns whereas it should be started after dns.

    I would check to see if this is still true in the most recent releases of Solaris Express. If it is, you can log a bug about it.
    For your existing machines, you could probably create a dependency on milestone/name-services for the ntp service and see if that fixes it.
    Darren

  • Removed my ipod too soon how do i refresh my ipod forget where info is in manual

    i removed my ipod too soon and lost all my songs except one how do i refresh it to make it work again I cant find it in manual

    If the shuffle's storage has data corruption, you should do a Restore.  The Restore button is on the shuffle's Summary screen in iTunes.  This will erase the shuffle, re-install its software, and set it to default settings.  You can then set it up to sync or load it manually from your iTunes library, as desired.
    If you are asking about how to load content on an empty shuffle, please post back.

  • Starting an iPhone app "too soon"

    When an app starts up on the device, the default image (if one exists) appears, and then, some time later, the application becomes actually active (e.g., data appears on the screen "filling in the blanks"). I've noticed on my applications that if I tap the screen too soon, i.e., after the default image loads (which, to the average user, means the app is running) but before the app is fully loaded, that it tends to "hang," ignoring keypresses etc even after the app has subsequently loaded.
    Is there a "trick" to disable the user interactivity until it is ready to be acknowledged?

    If it helps, my iSO is 7.1.1
    It is an action from two events
    1. using the kissanime streaming site. [which I can understand]
    2. happens even when I'm not using the site. [but not as often, yet]
    In the first case, I sometimes get an iPhone pop-up that asks me if I want to open the app page. it reads more like something wants to open an app page, do you agree ? More exactly like the pop-up says something can't open to the app store page, will I allow it?
    I'll do a capture of it later and be more exact.
    The times it just pops me over there when I'm not on that site nor using the browser are completely unexpected.
    What I would prefer is that any such action acting upon my phone -always- asks the user if he/she/I will allow it.
    It seems to be neccessary to prevent what I will think of as 'slimeware' forcing the iPhone to go to their app-store pages.
    Since that requestor happens sometime, there should be a way to have it always be active; even if it requires an iSO update to have it be so. If I could make it always be active, I would consider the problem to be solved.

  • Ggrrrrr, is there any that bios that fixes the temp issue? [solved]..spoke too soon [NOT SOLVED]

    ive tried
    1.1
    1.2
    1.3
    1.42
    come on msi, give me a fighting chance :(

    Here is the last thing I received from MSI tech support.  I'll give them this much, they are much more responsive than VIA or AOpen ever were when I first got my flakey MVP3 board...lol.  I hope they can figure this problem out!
    Quote
    So far in our own testing, we have not found any High CPU Temperature issues.
    We have gone through the threads you have provided to us and we will co-work with AMD to see if anything needs to be updated from our side with the New Castle Core.
    Once again, MSI appreciates all the findings/reports you have provided to us and we will update you once there is any findings becomes available.
    Sincerely,
    Technical Support Division
    MSI Computer Corp.
    http://www.msicomputer.com
    MSI - Beyond Expectations!  
    1-626-913-0828
    1-626-581-7721 Fax
    Due to high volume of cases daily, we may not be able to answer question promptly. Please kindly provide your name, phone number, model number, state in which you are calling from, a brief description of your problems, and we will try to reply your issue as promptly as possible. Thanks
    The information transmitted is intended only for the person or entity to which it is addressed and contained confidential and privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient are prohibited. If you receive this in error, please contact the sender and delete the material from any computer.
    -----Original Message-----
    From: my email deleted
    Sent: Friday, August 06, 2004 8:51 AM
    To: [email protected]
    Subject: RE: 3 -- Customer Problem Description Form
    I know you guys think you fixed the Newcastle temperature problem.  But there are still a LOT of us out here who are having trouble, using latest BIOS.  People are reporting this all over the MSI forums.  The behavior is as follows, flashing the BIOS might help initially, but soon after the temp shoots way back up.
    Please see the following threads:
    Temps and BIOS 1.42
    ggrrrrr, is there any that bios that fixes the temp issue? [solved]..spoke too soon [NOT SOLVED]
    Possible fix for CPU temp problem found.
    The same old problem with temperatures (K8N Neo Platinum)
    K8N Neo Temps :(

  • Presenter 10 jumps to next slide too soon in html 5

    I created a presentation from powerpoint 2013 64bit, set to FM quality sound using Presenter 10.0.0 build 196. It is delivered by an Adobe Connect server. The presentations created this way are jumping to the next slide too soon when viewed online, which cuts off the last few words. I have to manually add blank space at the end of the audio for each slide and then upload it multiple times to check that it is OK. Is anyone else having this issue, and is there a known solution?

    I have tried the remove and re-add and it makes no difference. I can't now get the Presenter presentation with video in mp4 format to display or play. I am not sure if it is there or not as when viewing on an iPad it says it is buffering but never actually stops buffering. I can see it on my computer fine and it plays fine, but some of the reason for publishing to html 5 is so as it can be seen by people using tablets.  I just can't seem to get it to work no matter what I try.
    So to recap:
    1. using a presentation published using an older version of Presenter that contains flv videos
    2. republishing the presentation using Presenter 10 to a Connect Content Library using HTML 5
    3. have to convert the flv to mp4
    4. on a computer using a variety of browsers the presentation plays fine.
    5. on a tablet (iPad tried at this stage) the slides without video plays fine, the slides with video just continually says buffering
    On the second point of Presenter throwing up an error message, it's not so much that it throws up the error message as I can cancel that. It's more to do with the fact that it throws it up each time I try to publish a presentation that includes video that is of a certain duration.  I have followed the whole kill the process as suggested and while this does indeed stop the problem it just comes back when I open PowerPoint again and try to publish.

  • NIO blocking socket returns too soon

    Hi,
    I'm having a strange behaviour: a read() call on a blocking socket (I've double checked) returns before it's full. It's not a timeout issue since the SO_TIMEOUT option is set to 0 (infinity).
    Any hint?
    JL

    That's how it's supposed to work.
    From the javadoc for ReadableByteChannel.read():
    A read operation might not fill the buffer, and in fact it might not read any bytes at all. Whether or not it does so depends upon the nature and state of the channel. A socket channel in non-blocking mode, for example, cannot read any more bytes than are immediately available from the socket's input buffer; similarly, a file channel cannot read any more bytes than remain in the file. It is guaranteed, however, that if a channel is in blocking mode and there is at least one byte remaining in the buffer then this method will block until at least one byte is read.

  • IPod Return Waiting Too Long

    This is my second ipod i've shipped for warrenty due to hard drive errors, first repair took 1 day for each step on the page where you check your repair status, and I got it back in less than a week. The second repair has been on "diagnosing" since last Friday (around 4 buisness days ago) and it still hasn't changed. I've heard diagnose takes at most 2 days. I'm concerned this isn't normal. They might have lost my ipod?!?! Diagnose shouldn't take this long, the issue is quite obvious, the ipod's hard drive is messed up (Strange noises to ipod when tilted and doesnt respond past the intro screen). Is this normal to have diagnose for 4 days?

    It took about a week or two for them to return my iPod when I sent it in, so it should be back soon.

Maybe you are looking for