[Previous] [Contents] [Next]

Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

pm_detach()

Release a handle to a power managed object

Synopsis:

#include <sys/pm.h>

int pm_detach(pm_hdl_t hdl);

Arguments:

hdl
A handle to the power manager object obtained via pm_attach()

Library:

libpm

Description:

The pm_detach() closes the client connection to the power managed object.

Returns:

0
Success.
-1
An error has occurred (errno is set).

Errors:

EBADF
hdl is not a valid handle.

Examples:

#include <sys/pm.h>
#include <fcntl.h>
#include <stdlib.h>
int
main()
{
   pm_hdl_t        hdl;

   // attach to object with read-only access
   hdl = pm_attach("object", O_RDONLY);
   if (!pm_valid_hdl(hdl)) {
      perror("pm_attach");
      return EXIT_FAILURE;
   }
  
   if (pm_detach(hdl) == -1) {
      perror("pm_detach");
      return EXIT_FAILURE;
   }
  
   return EXIT_SUCCESS;
}

Classification:

Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

pm_attach()


[Previous] [Contents] [Next]