mpiThreadDelete
Declaration
MPI_DECL1 MPI_RESULT MPI_DECL2 mpiThreadDelete(MPIThread thread);
Required Header: stdmpi.h
Change History: Added in 04.00.
Description
mpiThreadDelete deletes a thread object and invalidates its handle (thread). mpiThreadDelete is the equivalent of a C++ destructor
Note: mpiThreadDelete does not stop an executing thread.
thread | A handle to the MPIThread object to be deleted. |
---|
Sample Code
MPI_RESULT MPI_DECL2 helloThreadMain(void* threadData) { /* print event type to screen. */ printf("Hello from another thread.\n" " threadData = 0x%08x", threadData); return MPIMessageOK; } /* Wait for a thread to end */ MPI_RESULT threadJoin(MPIThread thread) { MPIThreadStatus status; MPI_RESULT returnValue = MPIMessageOK; while (returnValue == MPIMessageOK) { returnValue = mpiThreadStatus(thread, &status); if ((returnValue == MPIMessageOK) && (status.active == FALSE)) { break; } mpiPlatformSleep(10); } return returnValue; } void sayHello() { MPIThread thread; MPI_RESULT returnValue; returnValue = mpiThreadCreate(&thread, NULL); msgCHECK(returnValue); returnValue = mpiThreadStart(thread, helloThreadMain, NULL); msgCHECK(returnValue); returnValue = threadJoin(thread); msgCHECK(returnValue); returnValue = mpiThreadDelete(thread); msgCHECK(returnValue); }