imgtReleaseBuffer

Releases a buffer after the application has completed processing the message.

Prototype

DWORD imgtReleaseBuffer ( CTAHD ctahd, void *buffer )

Argument

Description

ctahd

Context handle returned by ctaCreateContext.

buffer

Pointer to buffer to be released.


Return values

Return value

Description

SUCCESS

 

CTAERR_INVALID_HANDLE

The specified context handle is invalid.

IMGTERR_INVALID_BUFFER

buffer does not point to a valid buffer.


Events

None.

Details

This function sends an indication to the IMGT manager that the application has finished processing an event buffer (described by the CTA_EVENT buffer and size fields) and is returning that buffer to the IMGT service.

The application must return every event buffer to the IMGT service as soon as possible or the IMGT service can run out of buffers and stop passing events to the application.

Example

void MyEventHandler( CTAHD ctahd )
{
   DWORD ret;
   CTA_EVENT event;
   char *errortext="";

   while( 1 )
   {
       ret = ctaWaitEvent( ctahd, &event, 100 );
   
       switch( event.id )
       {
    case CTAEVN_WAIT_TIMEOUT:
        break;
       case IMGTEVN_RCV_MESSAGE:
          /* process the buffer */
          ...
          ret = imgtReleaseBuffer( ctahd, event.buffer );
          if (ret != SUCCESS)
          {
              ctaGetText( ctahd, ret, (char *) errortext, 40);
              printf( "imgtReleaseBuffer failure: %s\n",errortext );
              exit( 1 );
           }
           break;
       } /* end of switch */
   }/* end of while */
}