Recent

Author Topic: does laz4android support BeginThread( ) this function?  (Read 11878 times)

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
does laz4android support BeginThread( ) this function?
« on: September 04, 2014, 10:05:46 am »
does laz4android support BeginThread( ) this function?

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
laz4android no idea to use MultiThread?
« Reply #1 on: September 12, 2014, 12:11:35 pm »
laz4android no idea to use MultiThread?
i just test BeginThread this function,when call it ,program quit immediately.

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: laz4android no idea to use MultiThread?
« Reply #2 on: September 14, 2014, 10:39:06 am »
well,i have search the web ,it have a way to use thread,
that is use 'pthread_create' this function,if want to use jni in thread maybe need use some other functions.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: laz4android no idea to use MultiThread?
« Reply #3 on: September 14, 2014, 12:25:57 pm »
I don't know whether BeginThread works there (you did have CThreads in your program's uses clause, don't you?), but I use jmpessoa's Android Module Wizard and it has jAsyncProcess which works just fine for multithreading. Certainly the thread handling is different.

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: laz4android no idea to use MultiThread?
« Reply #4 on: September 14, 2014, 02:29:51 pm »
BeginThread can not work,and  jmpessoa's Android Module Wizard need to use eclipse?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: laz4android no idea to use MultiThread?
« Reply #5 on: September 14, 2014, 02:46:59 pm »
jmpessoa's Android Module Wizard need to use eclipse?
No. I don't use Eclipse at all, only Ant.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: does laz4android support BeginThread( ) this function?
« Reply #6 on: September 14, 2014, 02:51:53 pm »
It supports only what is supported in JNI libraries, see the list here:

http://wiki.freepascal.org/Custom_Drawn_Interface/Android#NDK_Libraries_available_in_Android_2.2_.28API_level_8.29

I don't know in which library exacty "cthreads" unit links to...

Well, there do is in the list above the library "libthread_db" which is debug info for pthreads, so I guess that pthreads is supported in JNI, probably in the unit libc.so

One would need to modify cthreads unit to link to this library.

I have an Android application written in (mostly) Pascal, but my Pascal code is single-threaded ...

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: does laz4android support BeginThread( ) this function?
« Reply #7 on: September 14, 2014, 02:59:22 pm »
yes,i just use "pthread_create" this function.it can works,it is in the "libc.so",just found it from web.
and Lazarus Android Module Wizard  how to use?i see it use eclipse in the manual.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: does laz4android support BeginThread( ) this function?
« Reply #8 on: September 14, 2014, 03:28:21 pm »
Quote
Lazarus Android Module Wizard  how to use?i see it use eclipse in the manual
Read carefully. It CAN use Eclipse, but it's not a REQUIREMENT. What Eclipse does is only automating the call to Android SDK tools (google even has an IDE-less tutorial), and that's just one or two commands, with one done only once (to create the project structure). The other is simply building the project, which you can do with Ant. Simply by copying build.xml from ant demo and modify it to your project (or Eclipse demo), you can build everything without ever needing to install Eclipse.

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: does laz4android support BeginThread( ) this function?
« Reply #9 on: September 14, 2014, 03:35:20 pm »
i am a newer,sorry ,i do not know what is ant. is it android sdk tool or java tool?:o

Mike.Cornflake

  • Hero Member
  • *****
  • Posts: 1260
Re: does laz4android support BeginThread( ) this function?
« Reply #10 on: September 14, 2014, 03:43:17 pm »
https://www.google.com.au/search?q=ant
http://ant.apache.org/

Very powerful utility that one, seen it configured to do some amazing stuff.  At the time it struck me as steep learning curve is required to create a new project.  Editing an existing one (as per leledumbo's suggestion) should be easy enough though.
Lazarus Trunk/FPC Trunk on Windows [7, 10]
  Have you tried searching this forum or the wiki?:   http://wiki.lazarus.freepascal.org/Alternative_Main_Page
  BOOKS! (Free and otherwise): http://wiki.lazarus.freepascal.org/Pascal_and_Lazarus_Books_and_Magazines

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: does laz4android support BeginThread( ) this function?
« Reply #11 on: September 14, 2014, 03:46:27 pm »
thanks all, i will get some time to learn it. :D

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: does laz4android support BeginThread( ) this function?
« Reply #12 on: September 14, 2014, 04:06:04 pm »
ask a new question, is Lazarus Android Module Wizard call android functions still
need to use JNI functions to call them?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: does laz4android support BeginThread( ) this function?
« Reply #13 on: September 14, 2014, 04:11:23 pm »
ask a new question, is Lazarus Android Module Wizard call android functions still
need to use JNI functions to call them?
better a new thread but yes, it uses JNI to wrap calls to Android library (well, that seems to be the only way to go).

greenzyzyzy

  • Full Member
  • ***
  • Posts: 249
Re: does laz4android support BeginThread( ) this function?
« Reply #14 on: September 14, 2014, 04:21:37 pm »
if i want to call other Android functions in "Lazarus Android Module Wizard" program,
still need JNI functions?

 

TinyPortal © 2005-2018