Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

From: Bert Wesarg (wesarg_at_[hidden])
Date: 2007-07-19 05:34:35


Hello,

> Author: brbarret
> Date: 2007-07-18 16:23:45 EDT (Wed, 18 Jul 2007)
> New Revision: 15492
> URL: https://svn.open-mpi.org/trac/ompi/changeset/15492
>
> Log:
> add ability to have thread-specific data on windows, pthreads, solaris
> threads,
> and non-threaded builds
>
> +int
> +opal_tsd_key_create(opal_tsd_key_t *key,
> + opal_tsd_destructor_t destructor)
> +{
> + int i;
> +
> + if (!atexit_registered) {
> + atexit_registered = true;
> + if (0 != atexit(run_destructors)) {
> + return OPAL_ERR_TEMP_OUT_OF_RESOURCE;
> + }
> + }
> +
> + for (i = 0 ; i < TSD_ENTRIES ; ++i) {
> + if (entries[i].used == false) {
> + entries[i].used = true;
> + entries[i].value = NULL;
> + entries[i].destructor = destructor;
> + *key = i;
               break;
> + }
> + }
> + if (i == TSD_ENTRIES) return ENOMEM;
> +
> + return OPAL_SUCCESS;
> +}

Bert