//int	GetQueueEvent(HANDLE handle, struct block_queue *EventQ,st_io **io ,int timeout)
int	GetQueueEvent(HANDLE handle, MsgQueue_t EventQ,st_io **io ,int timeout)
{
	assert(EventQ);assert(io);
/*	
	engine_t e = GetEngineByHandle(handle);
	if(!e)
		return -1;
	spin_lock(e->mtx,0);//mutex_lock(e->mtx);
	if(e->status == 0)
	{
		spin_unlock(e->mtx);//mutex_unlock(e->mtx);
		return -1;
	}
	
	if(*io = LIST_POP(st_io*,e->buffering_event_queue))
	{
		spin_unlock(e->mtx);//mutex_unlock(e->mtx);
		return 0;
	}
	//插入到等待队列中,阻塞
	LIST_PUSH_FRONT(e->block_thread_queue,EventQ);
	spin_unlock(e->mtx);//mutex_unlock(e->mtx);

	if(POP_FORCE_WAKE_UP == BLOCK_QUEUE_POP(EventQ,io,timeout))
		return -1;//因为engine的释放而被强制唤醒
	*/
	engine_t e = GetEngineByHandle(handle);
	if(!e)
		return -1;
	mutex_lock(e->mtx);
	if(e->status == 0)
	{
		mutex_unlock(e->mtx);
		return -1;
	}
	
	if(*io = LIST_POP(st_io*,e->buffering_event_queue))
	{
		mutex_unlock(e->mtx);
		return 0;
	}
	//插入到等待队列中,阻塞
	LIST_PUSH_FRONT(e->block_thread_queue,EventQ);
	mutex_unlock(e->mtx);

	GetMsg(EventQ,io,sizeof(*io),0);
	if(*io == 0)
		return -1;
	
	return 0;	
}
s32int main()
{
  list_t list;
  STATIC_TYPE_LIST_INIT(list, u32int);

  //Test variables
  u32int test = 100, mid = 200, end = 300;
  u32int arr[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  //Test variables

  LIST_INSERT_ARRAY(list, 0, arr + 1, 4);

  LIST_PUSH_BACK(list, test);
  LIST_PUSH_BACK(list, mid);
  LIST_PUSH_BACK(list, end);

  LIST_PUSH_FRONT(list, end);
  LIST_PUSH_FRONT(list, end);
  LIST_PUSH_FRONT(list, end);
  LIST_POP_BACK(list);

  LIST_INSERT(list, 1, mid);

  u32int foreachTmp;
  size_t sizer;

  LIST_FRONT(list, foreachTmp);
  printf("FRONT %d\n", foreachTmp);
  LIST_BACK_WITH_SIZE(list, foreachTmp, sizer);
  printf("BACK %d size %zu\n\n", foreachTmp, sizer);

  LIST_ERASE(list, 0);
  
  LIST_FOREACH(foreachTmp, list)
  {
    printf("Test %d\n", foreachTmp);
  }