pthread_condattr_setclock on MAC

Issue #43 resolved
Alexander Ukhov created an issue

Hello All! I have a question regarding ODE v0.15 compilation on MAC

I got the following error:

./threading_impl_posix.h:166:37: error: use of undeclared identifier 'pthread_condattr_setclock'; did you mean 'pthread_condattr_setpshared'? int condattr_clock_result = pthread_condattr_setclock(&cond_condattr, CLOCK_MONOTONIC); ^~~~~~~~~ pthread_condattr_setpshared

But ODE v0.13 compiles with the same configure parameters without any problems.

Looks like HAVE_CLOCK_GETTIME has to be undefined if compile on MAC's.

Thanks!

Comments (17)

  1. Oleh Derevenko Account Deactivated

    I have default-enabled some parts that were excluded by default in previous releases. In particular this is the built-in threading implementation that allows using several threads for running simulations.

    Alas, I do not have Mac system to test for compatibility. If you will be willing to help, we can try to resolve this.

  2. Oleh Derevenko Account Deactivated

    So, I looked in sources and what I can say, this define was once used to support compilation on Macs. It just looks like your system now does have clock_gettime() but still does not have pthread_condattr_setclock().

    What particular OS version do you have?

  3. Oleh Derevenko Account Deactivated

    You should be able to run "man clock_gettime", I suppose.

    Could you please paste the output here?

  4. Alexander Ukhov reporter

    I change libtoolize to glibtoolize in bootstrap script. Maybe it is because of that?

  5. Oleh Derevenko Account Deactivated

    Thank you.

    No, your change does not matter for this.

    May I also ask for "man pthread_cond_timedwait"?

  6. Oleh Derevenko Account Deactivated

    Could you please get the latest version from the repository and check if it builds for you?

  7. Alexander Ukhov reporter

    It works! Thank you very much!

    So, to take advantage of ODE internal threading I need to use these flags in ./configure ? "--enable-ou --enable-builtin-threading-impl"

  8. Oleh Derevenko Account Deactivated

    Not exactly. 1) These flags are enabled by default (see ./configure --help). You can disable them to save on library size if you don't need that. 2) The enabled features only "make it possible for you" to take the advantage. To use that mode you need to make several additional calls (see demo_boxstack, for example)

  9. Alexander Ukhov reporter

    Thanks! You mean, I need to make an extra calls of this:

    dThreadingImplementationID threading = dThreadingAllocateMultiThreadedImplementation();
    dThreadingThreadPoolID pool = dThreadingAllocateThreadPool(4, 0, dAllocateFlagBasicData, NULL);
    dThreadingThreadPoolServeMultiThreadedImplementation(pool, threading);
    // dWorldSetStepIslandsProcessingMaxThreadCount(world, 1);
    dWorldSetStepThreadingImplementation(world, dThreadingImplementationGetFunctions(threading), threading);
    

    // run simulation dsSimulationLoop(argc,argv,640,480,&fn);

    dThreadingImplementationShutdownProcessing(threading);
    dThreadingFreeThreadPool(pool);
    dWorldSetStepThreadingImplementation(world, NULL, NULL);
    dThreadingFreeImplementation(threading);
    
  10. Oleh Derevenko Account Deactivated

    Also add some return status/value validation. ODE demos are not the best example to be copied directly.

  11. Log in to comment