bool ctlComboBoxFix::SetKey(const wxString &val) { unsigned int i; for (i=0 ; i < GetCount() ; i++) { if (GetStringKey(i) == val) { SetSelection(i); return true; } } SetSelection(wxNOT_FOUND); return false; }
int OSI_OpenSM(const char* smID,TYPE_NGOS_SHAREMEMORY* pResult) { #ifndef ANDROID int intid = GetStringKey(smID); printf("sm open:%s = %X\n",smID,intid); int smResult = shmget(intid,0,0640); if(smResult < 0) { return -1; } *pResult = smResult; #endif return 0; }
int OSI_CreateSM(const char* smID,uint32_t size,TYPE_NGOS_SHAREMEMORY* pResult) { #ifndef ANDROID //todo:bug 同id的无法互斥创建,下一次创建依旧能成功 int intid = GetStringKey(smID); printf("sm create:%s = %X\n",smID,intid); int smResult = shmget(intid,size,0640|IPC_CREAT|IPC_EXCL); if(smResult < 0) { return -1; } *pResult = smResult; #endif return 0; }