mirror of
https://github.com/ioacademy-jikim/android_framwork
synced 2025-06-07 16:06:29 +00:00
9
This commit is contained in:
parent
7a0a2db279
commit
cf1e4e5d56
BIN
04_day.pptx
BIN
04_day.pptx
Binary file not shown.
@ -1,3 +1,40 @@
|
|||||||
|
#if 0
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <utils/Thread.h>
|
||||||
|
#include <utils/StrongPointer.h>
|
||||||
|
|
||||||
|
using namespace android;
|
||||||
|
//--------------------------------------------------------
|
||||||
|
class AAA : public RefBase
|
||||||
|
{
|
||||||
|
int ratio=0;
|
||||||
|
public:
|
||||||
|
AAA()
|
||||||
|
{
|
||||||
|
printf("AAA::AAA()\n");
|
||||||
|
}
|
||||||
|
void onFirstRef()
|
||||||
|
{
|
||||||
|
ratio = 100;
|
||||||
|
printf("AAA::onFirstRef()\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool foo(void)
|
||||||
|
{
|
||||||
|
printf("AAA::foo()\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
sp<AAA> pa = new AAA;
|
||||||
|
//AAA *pa = new AAA;
|
||||||
|
pa->foo();
|
||||||
|
//delete pa;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <utils/Thread.h>
|
#include <utils/Thread.h>
|
||||||
@ -9,11 +46,26 @@ class MyThread : public Thread
|
|||||||
{
|
{
|
||||||
int volume;
|
int volume;
|
||||||
public:
|
public:
|
||||||
|
MyThread()
|
||||||
|
{
|
||||||
|
printf("MyThread::MyThread()\n");
|
||||||
|
}
|
||||||
|
void onFirstRef()
|
||||||
|
{
|
||||||
|
printf("MyThread::onFirstRef()\n");
|
||||||
|
}
|
||||||
|
status_t readyToRun()
|
||||||
|
{
|
||||||
|
printf("MyThread::readyToRun()\n");
|
||||||
|
return NO_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
bool threadLoop(void)
|
bool threadLoop(void)
|
||||||
{
|
{
|
||||||
volume=100;
|
volume=100;
|
||||||
printf("MyThread::threadLoop(), volume=%d\n", volume);
|
printf("MyThread::threadLoop(), volume=%d\n", volume);
|
||||||
return false;
|
sleep(1);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
int main()
|
int main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user