Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to create a thread in C Android NDK

How to create a thread in C Android NDK

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialjavaandroidquestionworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ptr_Electron
    wrote on last edited by
    #1

    My development environment is Eclipse C Android NDK I want to create and run a Simple thread from a function I am trying to use

    pthread_create()

    Can some one point me to a simple thread example C Android What I tired and confusing for me is, what parms I need to pass to this function ?

    JNIEXPORT void JNICALL
    Java_org_testjni_android_Game_someFunction(JNIEnv * env, jobject obj)
    {

    L CPalliniC 2 Replies Last reply
    0
    • P ptr_Electron

      My development environment is Eclipse C Android NDK I want to create and run a Simple thread from a function I am trying to use

      pthread_create()

      Can some one point me to a simple thread example C Android What I tired and confusing for me is, what parms I need to pass to this function ?

      JNIEXPORT void JNICALL
      Java_org_testjni_android_Game_someFunction(JNIEnv * env, jobject obj)
      {

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What does the first part of your question have to do with the second? What thread are you trying to create and run? What is the JNI function for?

      1 Reply Last reply
      0
      • P ptr_Electron

        My development environment is Eclipse C Android NDK I want to create and run a Simple thread from a function I am trying to use

        pthread_create()

        Can some one point me to a simple thread example C Android What I tired and confusing for me is, what parms I need to pass to this function ?

        JNIEXPORT void JNICALL
        Java_org_testjni_android_Game_someFunction(JNIEnv * env, jobject obj)
        {

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        As Richard pointed out, there (should be) no need to export to the Java environment the pthread_create function. Make a wrapper (with a simpler signature) for that and then export to Java (if you need to) such a wrapper. As about pthread_create, its very man page[^] provides sample code.

        In testa che avete, signor di Ceprano?

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups