package SRevent

import (
	"fmt"
	"testing"
	"time"
)

func TestBroadCastSRevent(t *testing.T) {
	for i := 0; i < 100000; i++ {
		tmp := i
		go func() {
			fmt.Println("routine wait, ", tmp)
			exitout := WaitSRevent(SRevent_type_ChangeWifiEnd, 2*time.Second)
			fmt.Println(tmp, " exit, ", exitout)
		}()
	}

	time.Sleep(time.Second)
	fmt.Println("send event start!")
	BroadCastSRevent(SRevent_type_ChangeWifiEnd)

	WaitSRevent(SRevent_type_ChangeWifiEnd, 5*time.Second)
	fmt.Println("wait end!")
	select {}
}
