#ifndef __OSPSOFTH__
#define __OSPSOFTH__

#ifdef __cplusplus
extern "C" {
#endif



typedef struct tag_Osp_SoftQue
{
    lx_sem_t    mutex;
    lx_sem_t    sem;
    int32_t         Id;       //QUEUE ID
    char        Name[32];
    int32_t         EnIdx;    //入队索引  
    int32_t         DeIdx;    //出队索引
    int32_t         Dep;      //队列深度
    int32_t         CurNum;
    uint64_t         EnCnt;    //入队统计计数  
    uint64_t         DeCnt;    //出队统计计数 
    uint64_t         FullCnt;  //队列满统计计数  
    uint64_t         EmptyCnt; //队列空统计计数  
    uint32_t         Mask;
    uint64_t         Buf[];
}Osp_SoftQue;


#define QUE_NEED_WAKE               1
#define QUE_NO_NEED_WAKE            0

#define QUE_ISBLOCK                 1
#define QUE_NOBLOCK                 0


int32_t osp_create_softque(Osp_SoftQue *que, int32_t Dep, char *name);
int32_t osp_soft_que_enque(uint64_t value, Osp_SoftQue *que, int32_t IsNeedWake);
int32_t osp_softque_deque(uint64_t *pvalue, Osp_SoftQue *que, int32_t IsBlock);
int32_t osp_softque_dequetry(uint64_t *pvalue, Osp_SoftQue *que);
int32_t osp_softque_dequeTimeOut(uint64_t *pvalue, Osp_SoftQue *que, uint32_t timeout);
int32_t osp_get_soft_que_info(Osp_SoftQue *que, char *pbuf);
int32_t osp_get_soft_que_desc(char *pbuf);



#define OSP_SOFTQ_ENCNT(que) que->EnCnt
#define OSP_SOFTQ_DECNT(que) que->DeCnt
#define OSP_SOFTQ_CUR(que) que->CurNum
#define OSP_SOFTQ_DEP(que) que->Dep


#define OSP_SOFTQ_SIZE(dep) (sizeof(Osp_SoftQue) + sizeof(uint64_t) * dep)





#ifdef __cplusplus
}
#endif

#endif  /* __OSPSOFTH__ */

