#ifndef _DWC_EVENT_H
#define _DWC_EVENT_H

/*--------------------------------------------------------------------------
 *  Copyright (c) 2001-2004 Igor Daniloff. 
 *	All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at this directory.
 *------------------------------------------------------------------------*/
 
/* $Id: dwc_event.h,v 1.12 2005/09/21 09:20:43 asv Exp $ */

#include "dwc_type.h"
#include "dwc_fd.h"

#ifdef  __cplusplus
extern "C" {
#endif

typedef struct DWC_int_event_t*   DWC_event_t;        
typedef DWC_event_t               dwc_event_t;

DWC_event_t         dwc_event_create( DWC_string_t );
DWC_error_code_t    dwc_event_wait( DWC_event_t, DWC_timeout_t );
DWC_bool_t          dwc_event_set( DWC_event_t );
DWC_error_code_t    dwc_event_destroy( DWC_event_t );
/*
  The semantic of function similar (return codes has different value) 
  to function WaitForMultiplyObjects in Windows API.
  Parameters:
    DWC_event_t*    events - array of events that wait
    DWC_length_t    num_ev - number of events
    DWC_timeout_t   timeout - timeout for wait
    DWC_bool_t      wait_all - should wait all events or not
  Return:
    negative : wait failed (by timed out reason = DWC_TIMED)
    >0 : if wait_all is TRUE - mean that all events was set 
         if wait_all is FALSE - number of signaled event (number of first 
         signaled event if more that one event was set)
 */
int                 dwc_event_multiple_wait( DWC_event_t*, DWC_length_t, DWC_timeout_t, DWC_bool_t );

#if defined(__UNIX_DW)
DWC_fdsocket_t      dwc_event_get_handle( DWC_event_t );
#endif /* UNIX */

#ifdef  __cplusplus
}
#endif

#endif /* _DWC_EVENT_H */
