Re: [jnc-users] AttachCurrentThread
Status: Beta
Brought to you by:
soapy
|
From: Marko M. <ti...@sb...> - 2007-09-05 12:38:36
|
Hi Marco,
Thank you for the fast answer.
Thinking about it, I will probably opt for the SWT option and drop my =20
Swing/systray4j code...
Well, nevertheless, some comments to clarify the situation for you:
Zitat von Marco Trudel <mt...@gm...>:
> Hey Marko
>
> Marko Mocnik wrote:
>> Hi!
[...]
>> JDK1_1AttachArgs thread_args;
>> s_pVm->AttachCurrentThread( ( void** ) &s_pEnv, &thread_args );
>> ---------------------------------------------------------------
>> leave me with a NULL Environment.
>>
>> I did a quick search in the GNU Bugzilla and couldn=E2=80=99t find anythi=
ng on it.
>
> Directly, I have no idea what could be the reason for this. I think =20
> you should ask this on the GCJ users mailinglist.
>
I'm currently doing a build of the 20070831 gcc to test that further.
If the problem persists I will take further steps.
>> Second:
>> Without systray, the app launches.
>> But after a while, when I click some buttons or tabs, the GUI =20
>> Thread freezes and the app is no longer responding to anything.
>> That freezing can=E2=80=99t be fixed to any action, sometimes it happens =
=20
>> even before the JFrame is fully visible.
>
> There's probably a thread race respectively wrong synchronized code. =20
> The mingw port of GCJ has a bug that sometimes wait() can be =20
> signaled by a preceding signal().
> Now please note the Sun Javadoc of wait:
>
> As in the one argument version, interrupts and spurious wakeups are =20
> possible, and this method should always be used in a loop:
>
> synchronized (obj) {
> while (<condition does not hold>)
> obj.wait();
> ... // Perform action appropriate to condition
> }
>
> I guess now that your code doesn't loop for the wait and while - =20
> luckily - it never runs into problems with a Sun JRE, GCJs =20
> additional bug will expose the bug in your code.
Sun Java had exactly the same Bug in version 1.2 (or was it IBM Java?)
Since then I surround every wait with a loop.
Besides, I did not use any Thread-synchonization in the code.
>
>
>> I would really appreciate any help here.
>
> I assume you're programming AWT/Swing on Windows. If you want to be =20
> rid of any problems, use SWT. It has built-in support for system =20
> tray icons and SWT is fully supported with JNC/GCJ.
>
Thanks for that tip.
It will be some hell of work to port the app, but the benefits are convincin=
g.
Marko
>
> Hope that helps
> Marco
>
>
>> Thanks and bye,
>>
>> Marko
>>
>>
>> -------------------------------------------------------------------------
>> This SF.net email is sponsored by: Splunk Inc.
>> Still grepping through log files to find problems? Stop.
>> Now Search log events and configuration files using AJAX and a browser.
>> Download your FREE copy of Splunk now >> http://get.splunk.com/
>> _______________________________________________
>> javaCompiler-users mailing list
>> jav...@li...
>> https://lists.sourceforge.net/lists/listinfo/javacompiler-users
>
>
|