/* Use the state returned by ReadCurrentState and check that the state was not changed during the read operation. The operation is lock-free since there is no intermediate state in the write operation that could cause the read to loop forever. */ void JackFrameTimer::ReadFrameTime(JackTimer* timer) { UInt16 next_index = GetCurrentIndex(); UInt16 cur_index; do { cur_index = next_index; memcpy(timer, ReadCurrentState(), sizeof(JackTimer)); next_index = GetCurrentIndex(); } while (cur_index != next_index); // Until a coherent state has been read }
// Client void JackTransportEngine::ReadCurrentPos(jack_position_t* pos) { UInt16 next_index = GetCurrentIndex(); UInt16 cur_index; do { cur_index = next_index; memcpy(pos, ReadCurrentState(), sizeof(jack_position_t)); next_index = GetCurrentIndex(); } while (cur_index != next_index); // Until a coherent state has been read }
void TaskMiscPanel::ReClick() { if (GetCurrentIndex() > 0) SetCurrent(0); else PagerWidget::ReClick(); }
static void UpdatePos(DmOpenRef db) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormMain)) return; char posbuf[20]; StrPrintF(posbuf, "%d/%d", GetCurrentIndex() + 1, (UInt16) GetSMSCount(db, g_SelectedCategory)); FrmCopyLabel(form, LabelPosition, posbuf); }
void SelectPackageDlg::ListCursor() { int c = GetCurrentIndex(); if(c >= 0 && c < packages.GetCount()) { String pp = PackagePath(GetCurrentName()); Package pkg; pkg.Load(pp); description <<= pkg.description; } else description <<= Null; }
static Err ReplyCurrentRecord(DmOpenRef db) { FormPtr form = FrmGetActiveForm(); if (FormIsNot(form, FormReply)) return frmErrNotTheForm; MemHandle memHandle = 0; SMSDbRecordType smsRecord; Err err = GetSMSRecord(db, g_SelectedCategory, GetCurrentIndex(), smsRecord, memHandle, true); RETURN_ERR_ON_ERR(err); CheckNullPointer(memHandle); SetFieldText((FieldPtr) GetObjectPtr(form, FieldTo), smsRecord.phoneNumber); SetFieldText((FieldPtr) GetObjectPtr(form, FieldReference), smsRecord.content); FrmSetFocus(form, FrmGetObjectIndex(form, FieldCompose)); MemHandleUnlock(memHandle); return errNone; }
void SelectPackageDlg::ChangeDescription() { int ii = GetCurrentIndex(); if(ii >= 0 && ii < packages.GetCount()) { PkInfo& p = packages[ii]; WithDescriptionLayout<TopWindow> dlg; CtrlLayoutOKCancel(dlg, "Package description"); String pp = PackagePath(p.package); Package pkg; if(!pkg.Load(pp)) { Exclamation("Package does not exist."); return; } dlg.text <<= pkg.description; if(dlg.Run() != IDOK) return; pkg.description = ~dlg.text; pkg.Save(pp); p.description = description <<= ~dlg.text; if(alist.IsCursor()) alist.Set(2, ~dlg.text); } }
void DeleteCurrentRecord(DmOpenRef db) { DeleteRecordInCategory(db, GetCurrentIndex(), g_SelectedCategory); }
void SetCurrentRecordCategory(DmOpenRef db, Int16 category) { MoveRecordCategory(db, GetCurrentIndex(), g_SelectedCategory, category); }
Err DisplayCurrentRecord(DmOpenRef db) { return DisplayRecord(db, g_SelectedCategory, GetCurrentIndex()); }