<commit_before>/* -----------------------------------------------------------------------------
 * $Id: Schedule.h,v 1.7 1999/09/10 11:11:52 simonmar Exp $
 *
 * (c) The GHC Team 1998-1999
 *
 * Prototypes for functions in Schedule.c 
 * (RTS internal scheduler interface)
 *
 * ---------------------------------------------------------------------------*/

/* 
 * Initialisation
 */

void    initScheduler(void);

/* 
 * Miscellany
 */

void    awakenBlockedQueue(StgTSO *tso);
StgTSO *unblockOne(StgTSO *tso);
void    initThread(StgTSO *tso, nat stack_size);
void    interruptStgRts(void);
void    raiseAsync(StgTSO *tso, StgClosure *exception);

extern  nat context_switch;

void    awaitEvent(rtsBool wait);  /* In Select.c */
extern  nat ticks_since_select;	   /* ditto */

extern  StgTSO *run_queue_hd, *run_queue_tl;
extern  StgTSO *blocked_queue_hd, *blocked_queue_tl;

#ifdef DEBUG
extern void printThreadBlockage(StgTSO *tso);
#endif

#ifdef COMPILING_RTS_MAIN
extern DLLIMPORT StgTSO *MainTSO; /* temporary hack */
#else
extern StgTSO *MainTSO; /* temporary hack */
#endif
#define END_TSO_QUEUE  ((StgTSO *)(void*)&END_TSO_QUEUE_closure)

/* Add a thread to the end of the run queue.
 * NOTE: tso->link should be END_TSO_QUEUE before calling this macro.
 */
#define PUSH_ON_RUN_QUEUE(tso)			\
    if (run_queue_hd == END_TSO_QUEUE) {        \
      run_queue_hd = tso;			\
    } else {					\
      run_queue_tl->link = tso;			\
    }						\
    run_queue_tl = tso;

#define PUSH_ON_BLOCKED_QUEUE(tso)		\
    if (blocked_queue_hd == END_TSO_QUEUE) {    \
      blocked_queue_hd = tso;			\
    } else {					\
      blocked_queue_tl->link = tso;		\
    }						\
    blocked_queue_tl = tso;

#define END_CAF_LIST  stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)
<commit_msg>[project @ 1999-10-19 15:39:08 by simonmar] ASSERT that the tso link field is empty before pushing it on the end of a queue.<commit_after>/* -----------------------------------------------------------------------------
 * $Id: Schedule.h,v 1.8 1999/10/19 15:39:08 simonmar Exp $
 *
 * (c) The GHC Team 1998-1999
 *
 * Prototypes for functions in Schedule.c 
 * (RTS internal scheduler interface)
 *
 * ---------------------------------------------------------------------------*/

/* 
 * Initialisation
 */

void    initScheduler(void);

/* 
 * Miscellany
 */

void    awakenBlockedQueue(StgTSO *tso);
StgTSO *unblockOne(StgTSO *tso);
void    initThread(StgTSO *tso, nat stack_size);
void    interruptStgRts(void);
void    raiseAsync(StgTSO *tso, StgClosure *exception);

extern  nat context_switch;

void    awaitEvent(rtsBool wait);  /* In Select.c */
extern  nat ticks_since_select;	   /* ditto */

extern  StgTSO *run_queue_hd, *run_queue_tl;
extern  StgTSO *blocked_queue_hd, *blocked_queue_tl;

#ifdef DEBUG
extern void printThreadBlockage(StgTSO *tso);
#endif

#ifdef COMPILING_RTS_MAIN
extern DLLIMPORT StgTSO *MainTSO; /* temporary hack */
#else
extern StgTSO *MainTSO; /* temporary hack */
#endif
#define END_TSO_QUEUE  ((StgTSO *)(void*)&END_TSO_QUEUE_closure)

/* Add a thread to the end of the run queue.
 * NOTE: tso->link should be END_TSO_QUEUE before calling this macro.
 */
#define PUSH_ON_RUN_QUEUE(tso)			\
    ASSERT(tso->link == END_TSO_QUEUE);		\
    if (run_queue_hd == END_TSO_QUEUE) {	\
      run_queue_hd = tso;			\
    } else {					\
      run_queue_tl->link = tso;			\
    }						\
    run_queue_tl = tso;

#define PUSH_ON_BLOCKED_QUEUE(tso)		\
    ASSERT(tso->link == END_TSO_QUEUE);		\
    if (blocked_queue_hd == END_TSO_QUEUE) {    \
      blocked_queue_hd = tso;			\
    } else {					\
      blocked_queue_tl->link = tso;		\
    }						\
    blocked_queue_tl = tso;

#define END_CAF_LIST  stgCast(StgCAF*,(void*)&END_TSO_QUEUE_closure)

{'fraction_non_alphanumeric': 0.18826666666666667, 'fraction_numerical': 0.016533333333333334, 'mean_word_length': 2.376237623762376, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6842587', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1398, 'n_words': 297}