Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-06-18 Thread fredvs
>> The ideal thing would be to find some java mechanism that allows him to >>`append` this checksynchronize to `the` main loop, some main-loop hook >> of sorts. Hum, if somebody have some idea how to implement it, he is very welcome to show his way... ;-) PS: By the other way, here some conclusio

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-06-01 Thread fredvs
@ Ewald and Sven => many thanks ;-) > The ideal thing would be to find some java mechanism that allows him to >`append` this checksynchronize to `the` main loop, some main-loop hook of sorts. Yep, i will be hyper-interested by that feature... So, until that day will come, i will use a Java-timer

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-31 Thread Ewald
On 05/31/2014 12:38 PM, Sven Barth wrote: > On 31.05.2014 12:10, fredvs wrote: The question here is: where did you type it? >> Inside the loop in thread, after each queue()... and also just before >> end of >> thread. > > *That* does not help. Queue put's the method pointer you provide into >

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-31 Thread Sven Barth
On 31.05.2014 12:10, fredvs wrote: The question here is: where did you type it? Inside the loop in thread, after each queue()... and also just before end of thread. *That* does not help. Queue put's the method pointer you provide into a queue that needs to be read by the *main thread*. It *wi

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-31 Thread fredvs
>> The question here is: where did you type it? Inside the loop in thread, after each queue()... and also just before end of thread. >> the next thing to go for, is probably be to try to get this >>`CheckSynchronize;` integrated into java in a decent manner >> (applicable to most use cases, that

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread Sven Barth
Am 30.05.2014 13:09 schrieb "fredvs" : > Hum, so maybe, (im new in Java) use a Java-timer who calls > uos.checksynchro(); at regular time... If the timer event runs in the same thread as your current call to checksynchro resides then it will work. If it's executed by a different thread then not.

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread Ewald
On 05/30/2014 01:15 PM, fredvs wrote: > Please read my earlier post before this one > > @ Ewald, i have try with : > > While true do > Begin > ... code ... > > CheckSynchronize; > End; > > But this does not work... > The question here is: where

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
Please read my earlier post before this one @ Ewald, i have try with : While true do Begin ... code ... CheckSynchronize; End; But this does not work... Thanks - Many thanks ;-) -- View this message in context: http://free-pascal-ge

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
Yep, yep, yep some very good news... 1) Added a new procedure in fpc library: => procedure uos_checksynchro(PEnv: PJNIEnv; Obj: JObject) ; cdecl; begin checksynchronize(); end; 2) And, of course, in fpc library exported as: => exports ... uos_checksynchro name 'Java_uos_checksynchro', ... 3

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread Ewald
On 30 May 2014, at 10:46, fredvs wrote: > re-@ Ewald : > >>> It *must* be called in the context of the main thread (the thread that >>> loaded the library) > > OOps, so do you mean that CheckSynchronize must be called by Java ? > So i have to add a "custom" procedure in the fpc library (who wil

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread Michael Van Canneyt
On Fri, 30 May 2014, fredvs wrote: re-@ Ewald : It *must* be called in the context of the main thread (the thread that loaded the library) OOps, so do you mean that CheckSynchronize must be called by Java ? So i have to add a "custom" procedure in the fpc library (who will be only a fpc Ch

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
re-@ Ewald : >> It *must* be called in the context of the main thread (the thread that >> loaded the library) OOps, so do you mean that CheckSynchronize must be called by Java ? So i have to add a "custom" procedure in the fpc library (who will be only a fpc CheckSynchronize()) ? Is it that that

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread Michael Van Canneyt
On Fri, 30 May 2014, fredvs wrote: @ Ewald => thanks. Hum, i did use checksynchronize but it did not help... When do you call it. Must it be used with fptimer.ontimer too ? No. And why fptimer.ontimer is not executed ? If CheckSynchronize is not executed at regular intervals, fptime

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
@ Ewald => thanks. Hum, i did use checksynchronize but it did not help... Must it be used with fptimer.ontimer too ? And why fptimer.ontimer is not executed ? Will i have more luck with other timer like epiktimer from Graeme (or the new one from Michael) ? Thanks. PS : I will try with some more ch

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-29 Thread Ewald
On 05/29/2014 11:18 AM, fredvs wrote: > but the timer does not execute > CallvoidMethod at fptimer.ontimer... Just a guess here... To quote Sven a few mails ago: `CheckSynchronize is used to process calls to TThread.Synchronize and TThread.Queue. It *must* be called in the context of the main thr

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-29 Thread fredvs
Hello Sven, hello Michael => many tanks. I have follow your advices... but... I have then create a object and a procedure inside that object. I use then queue() or synchronize() inside the thread to execute that procedure of object. That procedure call CallvoidMethod. OK, everything compiles but

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-28 Thread Michael Schnell
On 05/26/2014 09:47 PM, fredvs wrote: Hum, checksynchronize(), i do not realy understand how to use in the thread/loop... I am working on an "ActiveNoUIi" widget type to be usable with Lazarus. Here you can use "normal" Lazarus compatible TTimers. This already works nicely for me (Linux X86

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread Sven Barth
On 26.05.2014 21:47, fredvs wrote: Yep, Michael, thanks... Ok then for Nil owner... Hum, checksynchronize(), i do not realy understand how to use in the thread/loop... In the loop i do not use synchronize, because the procedure that is called is a java/method and synchronize is for procedure of

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread fredvs
Yep, Michael, thanks... Ok then for Nil owner... Hum, checksynchronize(), i do not realy understand how to use in the thread/loop... In the loop i do not use synchronize, because the procedure that is called is a java/method and synchronize is for procedure of object outside the thread... (Or i mi

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread Michael Van Canneyt
On Mon, 26 May 2014, fredvs wrote: Hello. What is the best way to unthread a procedure ? I have try with a fptimer outside the thread but the thing that disturb me is that you need a tcomponent as owner to create it. And in the library i do not use any tcomponent... How to create a fptimer wi

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread fredvs
Hello. What is the best way to unthread a procedure ? I have try with a fptimer outside the thread but the thing that disturb me is that you need a tcomponent as owner to create it. And in the library i do not use any tcomponent... How to create a fptimer without owner ? I have try with fptimer.cr

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-03 Thread fredvs
>> Posting some code might help. I may post code but not sure it will help. The code is the same as http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java, section dealing with callback procedure ( but inside a thread). Hum, i would prefer some demo-working-code from somebody who knows how

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-03 Thread fredvs
>> Did you use AttachCurrentThread and DetachCurrentThread? Oops, what is that ? How must i use it ? >> Pay attention to the validity of local references as well as their >> number. Idem, what is "local references as well as their number." ? PS: Im a beginner with Java but, apart CallVoidMetho

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-02 Thread Michael Van Canneyt
On Fri, 2 May 2014, patspiper wrote: dumping, try "ulimit -c unlimited" before starting Java again Did you use AttachCurrentThread and DetachCurrentThread? That is probably the "additional glue code" I was talking about in my reply. Michael. ___

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-02 Thread patspiper
On 02/05/14 02:22, fredvs wrote: Hello. When a java class use a fpc library that call jni.CallVoidMethod inside a thread it crash the application. If the fpc library call jni.CallVoidMethod directly (not via a thread) => perfect, it works. Is that a known problem ? Maybe does it exist someth

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-02 Thread fredvs
>> In general, libraries and threading is not an easy story. Ok,..., but what is your advice to do a CallVoidMethod inside a thread ? PS: Everything, inside the thread is working perfectly, only CallVoidMethod does crash... Do you think i could have better result with a kind of post-messages ?

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-01 Thread Michael Van Canneyt
On Thu, 1 May 2014, fredvs wrote: Hello. When a java class use a fpc library that call jni.CallVoidMethod inside a thread it crash the application. If the fpc library call jni.CallVoidMethod directly (not via a thread) => perfect, it works. Is that a known problem ? Not known, but defini