12 messages in net.java.dev.jna.usersRe: [jna-users] JNA problems when wor...
FromSent OnAttachments
Stas OskinSep 17, 2008 5:06 am 
Timothy WallSep 17, 2008 6:07 am 
Stas OskinSep 17, 2008 9:55 am 
Timothy WallSep 17, 2008 10:39 am 
Wayne MeissnerSep 17, 2008 10:54 am 
Stas OskinSep 17, 2008 11:07 am 
Timothy WallSep 17, 2008 11:30 am 
Stas OskinSep 18, 2008 2:00 am 
Timothy WallSep 18, 2008 5:50 am 
Stas OskinSep 18, 2008 7:37 am 
Stas OskinSep 18, 2008 11:04 am 
Timothy WallSep 18, 2008 11:29 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] JNA problems when working with shared memoryActions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 18, 2008 5:50:37 am
List:net.java.dev.jna.users

On Sep 18, 2008, at 5:01 AM, Stas Oskin wrote:

Hi.

Note that this is only the case for when jna.protected=true/ Native.setProtected(true). Otherwise it's up to you whether you want entry to your library synchronized.

I see - any benefits to this approach when working with JNA?

Sometimes helps debugging. Generally it's only required for libraries that know nothing about thread safety.

I still trying to catch this crash (and learning Java debug tools) - mind checking the jstack dump below?

Thread 29488: (state = IN_NATIVE) - com.sun.jna.Pointer._getInt(long) @bci=0 (Compiled frame; information may be imprecise) - com.sun.jna.Pointer.getInt(long) @bci=6, line=427 (Compiled frame) - com.sun.jna.Structure.readValue(int, java.lang.Class, java.lang.Object) @bci=145, line=393 (Compiled frame) - com.sun.jna.Structure.readField(com.sun.jna.Structure $StructField) @bci=108, line=367 (Compiled frame) - com.sun.jna.Structure.read() @bci=79, line=282 (Compiled frame) - org.mem.VZFRAME.useMemory(com.sun.jna.Pointer, int) @bci=7, line=18 (Compiled frame) - com.sun.jna.Structure.useMemory(com.sun.jna.Pointer) @bci=3, line=187 (Compiled frame) - org.mem.VZFRAME.useMemory(com.sun.jna.Pointer) @bci=2, line=12 (Compiled frame) - org.mem.memoryManage.getRowNumber() @bci=8, line=83 (Compiled frame) - org.update.threads.CalcDataThread.run() @bci=32, line=31 (Compiled frame)

Also, I have a question - why in stack the code seems to go to JNA (com.sun.jna.Structure.useMemory(com.sun.jna.Pointer)), returns to my code (org.mem.VZFRAME.useMemory()) and then goes to JNA back again (com.sun.jna.Structure.read())? I mean, shouldn't it be one way?

Looks like your VZFrame overrides useMemory (both signatures), then calls super.useMemory (in both).

If you're calling VZFrame.useMemory explicitly, why? What does the "getRowNumber" code look like around line 83?