Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any suggestions: locking??



Hi,

I am closing my eyes and guessing here since i have no clue
what Operation_i, MUTEX or PrinterAid are and how they are
implemented.

If PrinterAid utilises System.out to write to the console and
addOperation is called late in the main and you are not invoking
the AWT event thread it MIGHT be possible that the 4 IS written out,
but to the buffered System.out and therefore doesnt make it to
the console before the application terminates.

Again i am just guessing because 1) i dont have more source
code to look at and 2) i am not sure how buffered console output
is handled under Classic.

I do know though that buffered log outputs have bitten many
programmers over the years.

If you have control over PrinterAid you should try to switch
System.out.printxxx to the unbuffered System.err instead.
That might show that the 4 is in fact printed out.

Or is there any other proof that the function doesn't return?

    /// Isak Styf

15 jun 2005 kl. 03.07 skrev Levi Yourchuck:

Hi all,

I am compiling with the javac tool on a pc with 1.4.2 I use -target 1.1 as well as -bootclasspath
with the JDKClasses.zip from the MRJ distro. Anyhow it compiles and runs great on the pc, but on
the mac i have the following strangeness, if anyone have any ideas it would help a lot. I am
stumped...


The code executes and prints out 1 2 & 3, it never prints out the 4 instead it just hangs. I
don't know how to work out the strangeness it seems like it's locking on trying to release the
lock!??


    public void addOperation( final Operation_i operation ) {
        PrinterAid.print( "addOperation 1> " + operation );
        synchronized( MUTEX ) {
            PrinterAid.print( "addOperation 2> " + operation );
            _operations.addElement( operation );
            PrinterAid.print( "addOperation 3> " + operation );
        }
        PrinterAid.print( "addOperation 4> " + operation );
    }

This is being called from the main()

_______________________________________________ Do not post admin requests to the list. They will be ignored. Java-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Any suggestions: locking?? (From: Levi Yourchuck <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.