Name

pthread_condattr_init, pthread_condattr_destroy
- condition attribute operations

Library

libc_r.lib libpthread.lib libthr.lib

Synopsis

  #include <pthread.h>
  int pthread_condattr_init (pthread_condattr_t *attr);
  int pthread_condattr_destroy (pthread_condattr_t *attr);

Return values

If successful, these functions return 0. Otherwise, an error number is returned to indicate the error.

Detailed description

Condition attribute objects are used to specify parameters to pthread_cond_init. Current implementation of conditional variables does not support any attributes, so these functions are not very useful.

The pthread_condattr_init function initializes a condition attribute object with the default attributes.(As of now None)

The pthread_condattr_destroy function destroys a condition attribute object.


Examples

 pthread_condattr_t condattr;
 int rc;
 /* Initialize a condition variable attributes object */
 if((rc=pthread_condattr_init(&condattr)) != 0)
 {
  fprintf(stderr,"Cannot initialize condition variable attributes object\n");
  return -1;
 }
 /* Destroy the condition variable attributes object */
 if(pthread_condattr_destroy(&condattr) != 0)
 {
  fprintf(stderr,"Error at pthread_condattr_destroy(), rc=%d\n", rc);
  return -1;
 }

         

Errors

The pthread_condattr_init function will fail if:
[ENOMEM]
  Out of memory.

The pthread_condattr_destroy function will fail if:

[EINVAL]
  Invalid value for attr.


See also

pthread_cond_init

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top