void JailbreakMainWindow::setProgress(int percentage) { THREAD_SAFE(this->progressBar->SetValue(percentage)); }
void JailbreakMainWindow::setStatusText(const wxString& text) { THREAD_SAFE(this->lbStatus->SetLabel(text)); }
int JailbreakMainWindow::msgBox(const wxString& message, const wxString& caption, int style) { int res; THREAD_SAFE(res = wxMessageBox(message, caption, style)); return res; }
void JailbreakMainWindow::setButtonEnabled(int enabled) { THREAD_SAFE(this->btnStart->Enable(enabled)); }
int sem_init(sem_t *sem, int pshared, unsigned int value) { int retval; if (!THREAD_SAFE()) THREAD_INIT(); /* * Range check the arguments. */ if (pshared != 0) { /* * The user wants a semaphore that can be shared among * processes, which this implementation can't do. Sounds like a * permissions problem to me (yeah right). */ errno = EPERM; retval = -1; goto RETURN; } if (value > SEM_VALUE_MAX) { errno = EINVAL; retval = -1; goto RETURN; } *sem = (sem_t)malloc(sizeof(struct sem)); if (*sem == NULL) { errno = ENOSPC; retval = -1; goto RETURN; } /* * Initialize the semaphore. */ if (pthread_mutex_init(&(*sem)->lock, NULL) != 0) { free(*sem); errno = ENOSPC; retval = -1; goto RETURN; } if (pthread_cond_init(&(*sem)->gtzero, NULL) != 0) { pthread_mutex_destroy(&(*sem)->lock); free(*sem); errno = ENOSPC; retval = -1; goto RETURN; } (*sem)->count = (u_int32_t)value; (*sem)->nwaiters = 0; (*sem)->magic = SEM_MAGIC; retval = 0; RETURN: return retval; }