[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_BroadcastEvent

Overview

Wake up events that are waiting to be triggered

Syntax

    int Ns_BroadcastEvent(
    	Ns_Event * event
    );

Description

Wake up all the threads waiting on the event. If no threads are waiting on the event, this function has no effect.

Example

    static Ns_Event myev;
    static Ns_Mutex mylock;
    
    void
    Init(void)
    {
    	/* Initialize the lock and event at startup. */
    	Ns_InitializeMutex(&mylock);
    	Ns_InitializeEvent(&myev);
    }
    
    /* Lock the mutex and wait for the event. */
    void
    WaitFunc(void)
    {
    	Ns_LockMutex(&mylock);
    	Ns_WaitForEvent(&myev, &mylock);
    }
    
    /* Wake up any waiting threads. */
    void
    BroadcastFunc(void)
    {
    	Ns_BroadcastEvent(&myev);
    }

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.