/*
 ******************************************************************************
 *  Copyright 1993 DeltaLink bv. All Rights Reserved.
 ******************************************************************************
 *
 * DeltaLink FactoryLink Utilities Header file
 *
 * File: fl_sync.h
 *
 */
#ifndef _FLSYNC_INCLUDED /* { */
#define _FLSYNC_INCLUDED 1

#define	S_INFINITE	0
#define	S_CHECK		  1

/*
 * define the necessities for building a critical section in SCO Unix
 */
#ifdef UNIX

typedef struct _criticalsection {

  char    name[ 16];

  int     semid;

} CRITICAL_SECTION;

#endif

/*
 * Define the critical section object
 */
extern CRITICAL_SECTION  Critical_RTDB;
extern CRITICAL_SECTION  Critical_SIGNAL;
extern CRITICAL_SECTION  Critical_ECHANGE;
extern CRITICAL_SECTION  Critical_ESIGNAL;

#ifdef WIN32

extern DWORD             Critical_owner;

#endif

int   InitializeCSection    ( CRITICAL_SECTION *, int );
int   DeleteCSection        ( CRITICAL_SECTION *);
int   EnterCSection         ( CRITICAL_SECTION *, int );
int   LeaveCSection         ( CRITICAL_SECTION *);
int   ValidCSection         ( CRITICAL_SECTION *);
int   SetCSectionOwner      ( void);
int   ResetCSectionOwner    ( void);
int   IsCSectionOwner       ( void);

#endif