コード例 #1
0
ファイル: joinTest.cpp プロジェクト: ChengJin01/omr
static void
createThread(omrthread_t *newThread, uintptr_t suspend, omrthread_detachstate_t detachstate,
			 omrthread_entrypoint_t entryProc, void *entryArg)
{
	omrthread_attr_t attr = NULL;
	intptr_t rc = 0;

	ASSERT_EQ(J9THREAD_SUCCESS, omrthread_attr_init(&attr));
	ASSERT_EQ(J9THREAD_SUCCESS, omrthread_attr_set_detachstate(&attr, detachstate));
	EXPECT_EQ(J9THREAD_SUCCESS,
			  rc = omrthread_create_ex(newThread, &attr, suspend, entryProc, entryArg));
	if (rc & J9THREAD_ERR_OS_ERRNO_SET) {
		printf("omrthread_create_ex() returned os_errno=%d\n", (int)omrthread_get_os_errno());
	}
	ASSERT_EQ(J9THREAD_SUCCESS, omrthread_attr_destroy(&attr));
}
コード例 #2
0
ファイル: createTest.cpp プロジェクト: LinHu2016/omr
intptr_t
omrthread_verboseCall(const char *func, intptr_t retVal)
{
        if (retVal != J9THREAD_SUCCESS) {
                intptr_t errnoSet = retVal & J9THREAD_ERR_OS_ERRNO_SET;
                omrthread_os_errno_t os_errno = J9THREAD_INVALID_OS_ERRNO;
#if defined(J9ZOS390)
                omrthread_os_errno_t os_errno2 = omrthread_get_os_errno2();
#endif /* J9ZOS390 */

                if (errnoSet) {
                        os_errno = omrthread_get_os_errno();
                }
                retVal &= ~J9THREAD_ERR_OS_ERRNO_SET;

                if (retVal == J9THREAD_ERR_UNSUPPORTED_ATTR) {
                        if (errnoSet) {
#if defined(J9ZOS390)
                                omrTestEnv->log(LEVEL_ERROR, "%s unsupported: retVal %zd (%zx) : errno %zd (%zx) %s, errno2 %zd (%zx)\n", func, retVal, retVal, os_errno, os_errno, strerror((int)os_errno), os_errno2, os_errno2);
#else /* !J9ZOS390 */
                                omrTestEnv->log(LEVEL_ERROR, "%s unsupported: retVal %zd (%zx) : errno %zd %s\n", func, retVal, retVal, os_errno, strerror((int)os_errno));
#endif /* !J9ZOS390 */
                        } else {
                                omrTestEnv->log(LEVEL_ERROR, "%s unsupported: retVal %zd (%zx)\n", func, retVal, retVal);
                        }
                } else {
                        if (errnoSet) {
#if defined(J9ZOS390)
                                omrTestEnv->log(LEVEL_ERROR, "%s failed: retVal %zd (%zx) : errno %zd (%zx) %s, errno2 %zd (%zx)\n", func, retVal, retVal, os_errno, os_errno, strerror((int)os_errno), os_errno2, os_errno2);
#else /* !J9ZOS390 */
                                omrTestEnv->log(LEVEL_ERROR, "%s failed: retVal %zd (%zx) : errno %zd %s\n", func, retVal, retVal, os_errno, strerror((int)os_errno));
#endif /* !J9ZOS390 */
                        } else {
                                omrTestEnv->log(LEVEL_ERROR, "%s failed: retVal %zd (%zx)\n", func, retVal, retVal);
                        }
                }
        } else {
                omrTestEnv->log("%s\n", func);
        }
        return retVal;
}