/*static char *SCCSID = "@(#)wakeup.c	6.2 91/10/20";*/
/*static char *SCCSID = "@(#)wakeup.c	6.2 91/10/20";*/
#ifndef  _BTXT
#define  _BTXT _BTXT
#define  _THISFILE "WAKEUP.C"
#include _THISFILE.C
#undef   _BTXT
#endif

#ifndef HDRS
#define HDRS

#define INCL_DOSERRORS
#include <os2.h>
#include <fsh.h>
#include "const.h"
#include "misc.h"
#include "chain.h"
#include "buf.h"
#include "dir.h"
#include "storage.h"
#include "volume.h"
#include "tables.h"
#include "lw.h"
#include "pbmacros.h"
#include "pb_ifs.h"
#include "frame.h"
#include "fsdata.h"

#endif

#include "pr_MISC.h"
#include "pr_DEBUG.h"

/*
 ***	Wakeup2 - Wakeup Blocked Threads and give them an IO-boost
 * 	          via procrun2
 *
 *	Wakeup2 wakes up any threads which were Blocked on this semaphore and
 * gives them an IO-boost.
 *
 *	ENTRY	pBlockChain = Address of semaphore
 *
 *	EXIT	none
 */

void
Wakeup2 (PVOID pBlockChain)
{
#ifdef DEBUGZIBO
    if (*MAKETYPE (pBlockChain, PULONG) == 0)
	INTERR ("Wakeup2 called when no one was waiting");
#endif

    _disable();                           //#86017

    ProcRun2 (pBlockChain);
    *MAKETYPE (pBlockChain, PULONG) = 0;

    _enable();                            //#86017
}

/*
 ***	Wakeup - Wakeup Blocked Threads
 *
 *	Wakeup wakes up any threads which were Blocked on this semaphore.
 *
 *	ENTRY	pBlockChain = Address of semaphore
 *
 *	EXIT	none
 */

void
Wakeup (pBlockChain)
PVOID pBlockChain;
{
#ifdef DEBUGZIBO
    if (*MAKETYPE (pBlockChain, PULONG) == 0)
	INTERR ("Wakeup called when no one was waiting");
#endif

    _disable();                           //#86017

    ProcRun (pBlockChain);
    *MAKETYPE (pBlockChain, PULONG) = 0;

    _enable();                            //#86017
}


/*
 ***	WakeupS - Wakeup a single Blocked Thread
 *
 *	WakeupS wakes up the first thread which is Blocked on this List.
 *
 *	ENTRY	pBlockChain = address of head of block chain
 *
 *	EXIT	none
 *
 *	BUGBUG - there is no API that will give us this from the FSD level.
 *	
 *	This is implemented as a macro in the prototype file.
 */
