Man Linux: Main Page and Category List

NAME

       ggiResourceAcquire,    ggiResourceRelease,   ggiResourceMustAcquire   -
       Acquire and release a LibGGI resource

SYNOPSIS

       #include <ggi/ggi.h>

       int ggiResourceAcquire(ggi_resource_t res, uint32_t actype);

       int ggiResourceRelease(ggi_resource_t res);

       int ggiResourceMustAcquire(ggi_resource_t res);

DESCRIPTION

       ggiResourceAcquire acquires (locks)  a  LibGGI  resource,  typically  a
       DirectBuffer  (see  examples  below).  The actype indicates the desired
       access type for the operation.  The following  flags  may  be  bitwise-
       or’ed together:

       GGI_ACTYPE_READ
              read access to the resource

       GGI_ACTYPE_WRITE
              write access to the resource

       ggiResourceRelease releases (unlocks) an already-acquired resource.

       ggiResourceMustAcquire determines whether or not the specified resource
       needs to be acquired before using.

RETURN VALUE

       ggiResourceAcquire and ggiResourceRelease return 0 on success, an  ggi-
       error(3) code on failure.

       ggiResourceMustAcquire  is  simply  a  macro  that  returns true if the
       resource must be explicitly acquired and released,  or  false  if  not.
       However,   it   is   still   safe   to   call   ggiResourceAcquire   or
       ggiResourceRelease even in the latter case; it would be a no-op.

EXAMPLES

       Using DirectBuffers:

       const ggi_directbuffer *dbuf;

       /* Acquire DirectBuffer before we use it. */
       if (ggiResourceAcquire(dbuf->resource, GGI_ACTYPE_WRITE) != 0) {
             fail("Error acquiring DirectBuffer\n");
       }

       /* Do framebuffer rendering here... */

       /* Release DirectBuffer when done with it. */
       ggiResourceRelease(dbuf->resource);

SEE ALSO

       ggi_directbuffer(3)