[astyle]: format coding style

git-svn-id: https://10.10.10.66:8443/svn/MediaProcessPlatform/trunk/mpp@170 6e48237b-75ef-9749-8fc9-41990f28c85a
This commit is contained in:
ChenHengming
2015-08-27 08:05:56 +00:00
parent d03943bcf1
commit 8249f27074
3 changed files with 27 additions and 14 deletions

View File

@@ -25,7 +25,8 @@
#define SEARCH_GROUP_NORMAL(id) search_group_by_id_no_lock(&service.mListGroup, id) #define SEARCH_GROUP_NORMAL(id) search_group_by_id_no_lock(&service.mListGroup, id)
#define SEARCH_GROUP_ORPHAN(id) search_group_by_id_no_lock(&service.mListOrphan, id) #define SEARCH_GROUP_ORPHAN(id) search_group_by_id_no_lock(&service.mListOrphan, id)
class MppBufferService { class MppBufferService
{
public: public:
MppBufferService(); MppBufferService();
~MppBufferService(); ~MppBufferService();

View File

@@ -265,7 +265,7 @@ MPP_RET os_allocator_ion_close(void *ctx)
p = (allocator_ctx_ion *)ctx; p = (allocator_ctx_ion *)ctx;
ret = close(p->ion_device); ret = close(p->ion_device);
if (ret < 0) if (ret < 0)
return (MPP_RET)-errno; return (MPP_RET) - errno;
return MPP_OK; return MPP_OK;
} }

View File

@@ -63,7 +63,8 @@ class Condition;
/* /*
* for shorter type name and function name * for shorter type name and function name
*/ */
class Mutex { class Mutex
{
public: public:
Mutex(); Mutex();
~Mutex(); ~Mutex();
@@ -71,7 +72,8 @@ public:
void lock(); void lock();
void unlock(); void unlock();
class Autolock { class Autolock
{
public: public:
inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); }
inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); }
@@ -89,20 +91,24 @@ private:
Mutex &operator = (const Mutex&); Mutex &operator = (const Mutex&);
}; };
inline Mutex::Mutex() { inline Mutex::Mutex()
{
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr); pthread_mutexattr_init(&attr);
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
pthread_mutex_init(&mMutex, &attr); pthread_mutex_init(&mMutex, &attr);
pthread_mutexattr_destroy(&attr); pthread_mutexattr_destroy(&attr);
} }
inline Mutex::~Mutex() { inline Mutex::~Mutex()
{
pthread_mutex_destroy(&mMutex); pthread_mutex_destroy(&mMutex);
} }
inline void Mutex::lock() { inline void Mutex::lock()
{
pthread_mutex_lock(&mMutex); pthread_mutex_lock(&mMutex);
} }
inline void Mutex::unlock() { inline void Mutex::unlock()
{
pthread_mutex_unlock(&mMutex); pthread_mutex_unlock(&mMutex);
} }
@@ -112,7 +118,8 @@ typedef Mutex::Autolock AutoMutex;
/* /*
* for shorter type name and function name * for shorter type name and function name
*/ */
class Condition { class Condition
{
public: public:
Condition(); Condition();
Condition(int type); Condition(int type);
@@ -124,21 +131,26 @@ private:
pthread_cond_t mCond; pthread_cond_t mCond;
}; };
inline Condition::Condition() { inline Condition::Condition()
{
pthread_cond_init(&mCond, NULL); pthread_cond_init(&mCond, NULL);
} }
inline Condition::~Condition() { inline Condition::~Condition()
{
pthread_cond_destroy(&mCond); pthread_cond_destroy(&mCond);
} }
inline void Condition::wait(Mutex& mutex) { inline void Condition::wait(Mutex& mutex)
{
pthread_cond_wait(&mCond, &mutex.mMutex); pthread_cond_wait(&mCond, &mutex.mMutex);
} }
inline void Condition::signal() { inline void Condition::signal()
{
pthread_cond_signal(&mCond); pthread_cond_signal(&mCond);
} }
class MppThread { class MppThread
{
public: public:
MppThread(MppThreadFunc func, void *ctx); MppThread(MppThreadFunc func, void *ctx);
~MppThread() {}; ~MppThread() {};