* resource limits. VirtualMachineError is probably too severe,
* so use OutOfMemoryError.
*/
- ALOGE("Thread creation failed (err=%s)", strerror(errno));
+ ALOGE("pthread_create (stack size %d bytes) failed: %s", stackSize, strerror(cc));
dvmSetFieldObject(threadObj, gDvm.offJavaLangThread_vmThread, NULL);
- dvmThrowOutOfMemoryError("thread creation failed");
+ dvmThrowExceptionFmt(gDvm.exOutOfMemoryError,
+ "pthread_create (stack size %d bytes) failed: %s",
+ stackSize, strerror(cc));
goto fail;
}
int cc = pthread_create(pHandle, &threadAttr, internalThreadStart, pArgs);
pthread_attr_destroy(&threadAttr);
if (cc != 0) {
- ALOGE("internal thread creation failed");
+ ALOGE("internal thread creation failed: %s", strerror(cc));
free(pArgs->name);
free(pArgs);
return false;
gDvm.nonDaemonThreadCount--; // guarded by thread list lock
if (gDvm.nonDaemonThreadCount == 0) {
- int cc;
-
ALOGV("threadid=%d: last non-daemon thread", self->threadId);
//dvmDumpAllThreads(false);
// cond var guarded by threadListLock, which we already hold
- cc = pthread_cond_signal(&gDvm.vmExitCond);
- assert(cc == 0);
+ int cc = pthread_cond_signal(&gDvm.vmExitCond);
+ if (cc != 0) {
+ ALOGE("pthread_cond_signal(&gDvm.vmExitCond) failed: %s", strerror(cc));
+ dvmAbort();
+ }
}
}
{
Thread* self = dvmThreadSelf();
Thread* thread;
- int cc;
lockThreadSuspend("res-all", why); /* one suspend/resume at a time */
LOG_THREAD("threadid=%d: ResumeAll starting", self->threadId);
* which may choose to wake up. No need to wait for them.
*/
lockThreadSuspendCount();
- cc = pthread_cond_broadcast(&gDvm.threadSuspendCountCond);
- assert(cc == 0);
+ int cc = pthread_cond_broadcast(&gDvm.threadSuspendCountCond);
+ if (cc != 0) {
+ ALOGE("pthread_cond_broadcast(&gDvm.threadSuspendCountCond) failed: %s", strerror(cc));
+ dvmAbort();
+ }
unlockThreadSuspendCount();
LOG_THREAD("threadid=%d: ResumeAll complete", self->threadId);
{
Thread* self = dvmThreadSelf();
Thread* thread;
- int cc;
lockThreadSuspend("undo", SUSPEND_FOR_DEBUG);
LOG_THREAD("threadid=%d: UndoDebuggerSusp starting", self->threadId);
* which may choose to wake up. No need to wait for them.
*/
lockThreadSuspendCount();
- cc = pthread_cond_broadcast(&gDvm.threadSuspendCountCond);
- assert(cc == 0);
+ int cc = pthread_cond_broadcast(&gDvm.threadSuspendCountCond);
+ if (cc != 0) {
+ ALOGE("pthread_cond_broadcast(&gDvm.threadSuspendCountCond) failed: %s", strerror(cc));
+ dvmAbort();
+ }
unlockThreadSuspendCount();
unlockThreadSuspend();