1
0
mirror of https://github.com/ioacademy-jikim/android_framwork synced 2025-06-07 16:06:29 +00:00
android_framwork/04_day/thread/IPCThreadState.cpp
ioacademy-jikim 96638c8b17 10
2018-06-15 13:46:18 +09:00

41 lines
662 B
C++

#if 1
#include <stdio.h>
#include <utils/Thread.h>
#include <utils/StrongPointer.h>
#include <binder/IPCThreadState.h>
using namespace android;
//--------------------------------------------------------
class MyThread : public Thread
{
public:
bool threadLoop()
{
IPCThreadState *ipc1 = IPCThreadState::self();
IPCThreadState *ipc2 = IPCThreadState::self();
printf("ipc1=%p\n", ipc1 );
printf("ipc2=%p\n", ipc2 );
return false;
}
};
int main()
{
sp<Thread> thread1 = new MyThread;
sp<Thread> thread2 = new MyThread;
thread1->run("MyThread1");
thread2->run("MyThread2");
thread1->join();
thread2->join();
return 0;
}
#endif