| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) | 
Check to see if an event is pending
int PhEventPeek( void *buffer,
                 unsigned size );
This function lets you check if an event is pending on the current Photon channel:
Since this function is nonblocking, you should find it useful for applications that need to run continuously and still interact with Photon.
#define EVENT_SIZE    sizeof( PhEvent_t ) + 1000
main( int argc, char *argv[] )
{
     int go = 1, count = 0;
     PhEvent_t *event;
     if( initialize() == -1 )
          exit( EXIT_FAILURE );
     
     if( NULL == ( event = malloc( EVENT_SIZE ) ) )
          exit( EXIT_FAILURE );
     
     while( go ) {
          if(( ++count & 15) == 0) {
               PgFlush();
               switch( PhEventPeek( event, EVENT_SIZE ) {
                    case Ph_EVENT_MSG:
                       PtEventHandler( event );
                       break;
                    case -1:
                       perror( "PhEventPeek failed" );
                       break;
               }
          }
          iterate_graphics_process();
     }
     exit( 0 );
}
Photon
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | No | 
PhAttach(), PhEventArm(), PhEventNext(), PhEventRead()
| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) |