| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) | 
Provide synchronous event notification
int PhEventNext( void *buffer,
                 unsigned size );
This function provides a completely synchronous event-notification mechanism. It causes the application to become REPLY-blocked on the currently attached Photon channel until an event occurs.
If the application's event queue contains an event when this call is made, Photon replies immediately with that event.
#define EVENT_SIZE    sizeof( PhEvent_t ) + 1000
main( int argc, char *argv[] )
{
     PhEvent_t *event;
     
     if( initialize() == -1 )
          exit( EXIT_FAILURE );
     
     if( NULL == ( event = malloc( EVENT_SIZE ) ) )
          exit( EXIT_FAILURE );
     
     while( 1 ) {
          switch( PhEventNext( event, EVENT_SIZE ) ) {
              case Ph_EVENT_MSG:
                 PtEventHandler( event );
                 break;
              case -1:
                 perror( "PhEventNext failed" );
                 break;
     }
   }
}
Photon
| Safety: | |
|---|---|
| Interrupt handler | No | 
| Signal handler | No | 
| Thread | No | 
PhAttach(), PhEventPeek(), PhEventRead(), PhGetMsgSize()
| ![[Previous]](../image-lib/prev.gif) | ![[Contents]](../image-lib/contents.gif) | ![[Index]](../image-lib/keyword_index.gif) | ![[Next]](../image-lib/next.gif) |