mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 845712 - Remove unnecessary void* casts because Darwin's pthread_t is a pointer. r=jesup
This commit is contained in:
parent
6395a2a239
commit
1c05621e09
@ -56,28 +56,28 @@ cprCreateThread (const char *name,
|
||||
CPR_INFO("%s: creating '%s' thread\n", fname, name);
|
||||
|
||||
/* Malloc memory for a new thread */
|
||||
threadPtr = (cpr_thread_t *)cpr_malloc(sizeof(cpr_thread_t));
|
||||
threadPtr = cpr_malloc(sizeof(cpr_thread_t));
|
||||
if (threadPtr != NULL) {
|
||||
if (pthread_attr_init(&attr) != 0) {
|
||||
|
||||
CPR_ERROR("%s - Failed to init attribute for thread %s\n",
|
||||
fname, name);
|
||||
cpr_free(threadPtr);
|
||||
return (cprThread_t)NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pthread_attr_setstacksize(&attr, stackSize) != 0) {
|
||||
CPR_ERROR("%s - Invalid stacksize %d specified for thread %s\n",
|
||||
fname, stackSize, name);
|
||||
cpr_free(threadPtr);
|
||||
return (cprThread_t)NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (pthread_create(&threadId, &attr, startRoutine, data) != 0) {
|
||||
CPR_ERROR("%s - Creation of thread %s failed: %d\n",
|
||||
fname, name, errno);
|
||||
cpr_free(threadPtr);
|
||||
return (cprThread_t)NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Assign name to CPR if one was passed in */
|
||||
@ -92,15 +92,15 @@ cprCreateThread (const char *name,
|
||||
* that an application does not attempt to create
|
||||
* the same thread twice.
|
||||
*/
|
||||
threadPtr->u.handleInt = (uint64_t)threadId;
|
||||
threadPtr->u.handlePtr = threadId;
|
||||
threadPtr->threadId = ++id;
|
||||
return (cprThread_t)threadPtr;
|
||||
return threadPtr;
|
||||
}
|
||||
|
||||
/* Malloc failed */
|
||||
CPR_ERROR("%s - Malloc for thread %s failed.\n", fname, name);
|
||||
errno = ENOMEM;
|
||||
return (cprThread_t)NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -114,7 +114,7 @@ void cprJoinThread(cprThread_t thread)
|
||||
|
||||
cprThreadPtr = (cpr_thread_t *) thread;
|
||||
MOZ_ASSERT(cprThreadPtr);
|
||||
pthread_join(cprThreadPtr->u.handleInt, NULL);
|
||||
pthread_join(cprThreadPtr->u.handlePtr, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +142,7 @@ cprDestroyThread (cprThread_t thread)
|
||||
/*
|
||||
* Make sure thread is trying to destroy itself.
|
||||
*/
|
||||
if (cprThreadPtr->u.handlePtr == (void*) pthread_self()) {
|
||||
if (cprThreadPtr->u.handlePtr == pthread_self()) {
|
||||
CPR_INFO("%s: Destroying Thread %d", __FUNCTION__, cprThreadPtr->threadId);
|
||||
pthread_exit(NULL);
|
||||
return CPR_SUCCESS;
|
||||
@ -209,7 +209,7 @@ pthread_t
|
||||
cprGetThreadId (cprThread_t thread)
|
||||
{
|
||||
if (thread) {
|
||||
return (pthread_t)(long) ((cpr_thread_t *)thread)->u.handleInt;
|
||||
return ((cpr_thread_t *)thread)->u.handlePtr;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user