[Haiku-commits] r27445 - haiku/trunk/src/apps/expander

jackburton at mail.berlios.de jackburton at mail.berlios.de
Fri Sep 12 11:55:03 CEST 2008


Author: jackburton
Date: 2008-09-12 11:55:02 +0200 (Fri, 12 Sep 2008)
New Revision: 27445
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=27445&view=rev

Modified:
   haiku/trunk/src/apps/expander/GenericThread.cpp
   haiku/trunk/src/apps/expander/GenericThread.h
Log:
First round of style changes: renamed all member variables from m_var_name to fVarName

Modified: haiku/trunk/src/apps/expander/GenericThread.cpp
===================================================================
--- haiku/trunk/src/apps/expander/GenericThread.cpp	2008-09-12 09:53:58 UTC (rev 27444)
+++ haiku/trunk/src/apps/expander/GenericThread.cpp	2008-09-12 09:55:02 UTC (rev 27445)
@@ -5,25 +5,27 @@
 
 #include <string.h>
 
-GenericThread::GenericThread(const char * a_thread_name, int32 a_priority, BMessage * a_message)
+GenericThread::GenericThread(const char * thread_name, int32 a_priority, BMessage * message)
 	:
-	m_thread_data_store(a_message),
-	m_thread_id(spawn_thread(private_thread_function, a_thread_name, a_priority, this)),
-	m_execute_unit(create_sem(1, "m_execute_unit")),
-	m_quit_requested(false),
-	m_thread_is_paused(false)
+	fThreadDataStore(message),
+	fThreadId(spawn_thread(private_thread_function, thread_name, a_priority, this)),
+	fExecuteUnit(create_sem(1, "ExecuteUnit sem")),
+	fQuitRequested(false),
+	fThreadIsPaused(false)
 {
-	if (m_thread_data_store == NULL)
-		m_thread_data_store	=	new BMessage();
+	if (fThreadDataStore == NULL)
+		fThreadDataStore	=	new BMessage();
 }
 
+
 GenericThread::~GenericThread()
 {
-	kill_thread(m_thread_id);
+	kill_thread(fThreadId);
 
-	delete_sem(m_execute_unit);
+	delete_sem(fExecuteUnit);
 }
 
+
 status_t
 GenericThread::ThreadFunction(void)
 {
@@ -65,6 +67,7 @@
 	return (B_OK);
 }
 
+
 status_t
 GenericThread::ThreadStartup(void)
 {
@@ -87,6 +90,7 @@
 	return B_OK;
 }
 
+
 status_t
 GenericThread::ThreadShutdown(void)
 {
@@ -96,6 +100,7 @@
 	return B_OK;
 }
 
+
 void
 GenericThread::ThreadStartupFailed(status_t a_status)
 {
@@ -105,6 +110,7 @@
 	Quit();
 }
 
+
 void
 GenericThread::ExecuteUnitFailed(status_t a_status)
 {
@@ -114,6 +120,7 @@
 	Quit();
 }
 
+
 void
 GenericThread::ThreadShutdownFailed(status_t a_status)
 {
@@ -123,6 +130,7 @@
 	// (is this good default behaviour?)
 }
 
+
 status_t
 GenericThread::Start(void)
 {
@@ -130,18 +138,19 @@
 
 	if (IsPaused())
 	{
-		status	=	release_sem(m_execute_unit);
+		status	=	release_sem(fExecuteUnit);
 		if (status != B_OK)
 			return status;
 
-		m_thread_is_paused	=	false;
+		fThreadIsPaused	=	false;
 	}
 
-	status	=	resume_thread(m_thread_id);
+	status	=	resume_thread(fThreadId);
 
 	return status;
 }
 
+
 int32
 GenericThread::private_thread_function(void * a_simple_thread_ptr)
 {
@@ -152,126 +161,144 @@
 	return (status);
 }
 
+
 BMessage *
 GenericThread::GetDataStore(void)
 {
-	return	(m_thread_data_store);
+	return	(fThreadDataStore);
 }
 
+
 void
-GenericThread::SetDataStore(BMessage * a_message)
+GenericThread::SetDataStore(BMessage * message)
 {
-	m_thread_data_store  =  a_message;
+	fThreadDataStore  =  message;
 }
 
+
 status_t
 GenericThread::Pause(bool a_do_block, bigtime_t a_timeout)
 {
 	status_t	status	=	B_OK;
 
 	if (a_do_block)
-		status	=	acquire_sem(m_execute_unit);
+		status	=	acquire_sem(fExecuteUnit);
 	// thread will wait on semaphore
 	else
-		status	=	acquire_sem_etc(m_execute_unit, 1, B_RELATIVE_TIMEOUT, a_timeout);
+		status	=	acquire_sem_etc(fExecuteUnit, 1, B_RELATIVE_TIMEOUT, a_timeout);
 	// thread will timeout
 
 	if (status == B_OK)
 	{
-		m_thread_is_paused	=	true;
+		fThreadIsPaused	=	true;
 		return (B_OK);
 	}
 
 	return status;
 }
 
+
 void
 GenericThread::Quit(void)
 {
-	m_quit_requested	=	true;
+	fQuitRequested	=	true;
 }
 
+
 bool
 GenericThread::HasQuitBeenRequested(void)
 {
-	return (m_quit_requested);
+	return (fQuitRequested);
 }
 
+
 bool
 GenericThread::IsPaused(void)
 {
-	return (m_thread_is_paused);
+	return (fThreadIsPaused);
 }
 
+
 status_t
 GenericThread::Suspend(void)
 {
-	return (suspend_thread(m_thread_id));
+	return (suspend_thread(fThreadId));
 }
 
+
 status_t
 GenericThread::Resume(void)
 {
-	release_sem(m_execute_unit);		// to counteract Pause()
-	m_thread_is_paused	=	false;
+	release_sem(fExecuteUnit);		// to counteract Pause()
+	fThreadIsPaused	=	false;
 
-	return (resume_thread(m_thread_id));	// to counteract Suspend()
+	return (resume_thread(fThreadId));	// to counteract Suspend()
 }
 
+
 status_t
 GenericThread::Kill(void)
 {
-	return (kill_thread(m_thread_id));
+	return (kill_thread(fThreadId));
 }
 
+
 void
 GenericThread::ExitWithReturnValue(status_t a_return_value)
 {
 	exit_thread(a_return_value);
 }
 
+
 status_t
 GenericThread::SetExitCallback(void(*a_callback)(void*), void * a_data)
 {
 	return (on_exit_thread(a_callback, a_data));
 }
 
+
 status_t
 GenericThread::WaitForThread(status_t * a_exit_value)
 {
-	return (wait_for_thread(m_thread_id, a_exit_value));
+	return (wait_for_thread(fThreadId, a_exit_value));
 }
 
+
 status_t
 GenericThread::Rename(char * a_name)
 {
-	return (rename_thread(m_thread_id, a_name));
+	return (rename_thread(fThreadId, a_name));
 }
 
+
 status_t
 GenericThread::SendData(int32 a_code, void * a_buffer, size_t a_buffer_size)
 {
-	return (send_data(m_thread_id, a_code, a_buffer, a_buffer_size));
+	return (send_data(fThreadId, a_code, a_buffer, a_buffer_size));
 }
 
+
 int32
 GenericThread::ReceiveData(thread_id * a_sender, void * a_buffer, size_t a_buffer_size)
 {
 	return (receive_data(a_sender, a_buffer, a_buffer_size));
 }
 
+
 bool
 GenericThread::HasData(void)
 {
-	return (has_data(m_thread_id));
+	return (has_data(fThreadId));
 }
 
+
 status_t
 GenericThread::SetPriority(int32 a_new_priority)
 {
-	return (set_thread_priority(m_thread_id, a_new_priority));
+	return (set_thread_priority(fThreadId, a_new_priority));
 }
 
+
 void
 GenericThread::Snooze(bigtime_t a_microseconds)
 {
@@ -280,6 +307,7 @@
 	Resume();
 }
 
+
 void
 GenericThread::SnoozeUntil(bigtime_t a_microseconds, int a_timebase)
 {
@@ -288,12 +316,14 @@
 	Resume();
 }
 
+
 status_t
-GenericThread::GetInfo(thread_info * a_thread_info)
+GenericThread::GetInfo(thread_info * thread_info)
 {
-	return (get_thread_info(m_thread_id, a_thread_info));
+	return (get_thread_info(fThreadId, thread_info));
 }
 
+
 thread_id
 GenericThread::GetThread(void)
 {
@@ -302,6 +332,7 @@
 	return (t_thread_info.thread);
 }
 
+
 team_id
 GenericThread::GetTeam(void)
 {
@@ -310,6 +341,7 @@
 	return (t_thread_info.team);
 }
 
+
 char *
 GenericThread::GetName(void)
 {
@@ -318,6 +350,7 @@
 	return strdup(t_thread_info.name);
 }
 
+
 thread_state
 GenericThread::GetState(void)
 {
@@ -326,6 +359,7 @@
 	return (t_thread_info.state);
 }
 
+
 sem_id
 GenericThread::GetSemaphore(void)
 {
@@ -334,6 +368,7 @@
 	return (t_thread_info.sem);
 }
 
+
 int32
 GenericThread::GetPriority(void)
 {
@@ -342,6 +377,7 @@
 	return (t_thread_info.priority);
 }
 
+
 bigtime_t
 GenericThread::GetUserTime(void)
 {
@@ -350,6 +386,7 @@
 	return (t_thread_info.user_time);
 }
 
+
 bigtime_t
 GenericThread::GetKernelTime(void)
 {
@@ -358,6 +395,7 @@
 	return (t_thread_info.kernel_time);
 }
 
+
 void *
 GenericThread::GetStackBase(void)
 {
@@ -366,6 +404,7 @@
 	return (t_thread_info.stack_base);
 }
 
+
 void *
 GenericThread::GetStackEnd(void)
 {
@@ -374,15 +413,17 @@
 	return (t_thread_info.stack_end);
 }
 
+
 void
 GenericThread::BeginUnit(void)
 {
-	acquire_sem(m_execute_unit); // thread can not be paused until it releases semaphore
+	acquire_sem(fExecuteUnit); // thread can not be paused until it releases semaphore
 }
 
+
 void
 GenericThread::EndUnit(void)
 {
-	release_sem(m_execute_unit); // thread can now be paused
+	release_sem(fExecuteUnit); // thread can now be paused
 }
 

Modified: haiku/trunk/src/apps/expander/GenericThread.h
===================================================================
--- haiku/trunk/src/apps/expander/GenericThread.h	2008-09-12 09:53:58 UTC (rev 27444)
+++ haiku/trunk/src/apps/expander/GenericThread.h	2008-09-12 09:55:02 UTC (rev 27445)
@@ -7,11 +7,11 @@
 class GenericThread
 {
 	public:
-		GenericThread(const char * a_thread_name = "generic_thread", int32 a_priority = B_NORMAL_PRIORITY, BMessage * a_message = NULL);
+		GenericThread(const char * thread_name = "generic_thread", int32 a_priority = B_NORMAL_PRIORITY, BMessage * message = NULL);
 		virtual	~GenericThread(void);
 
 		BMessage *	GetDataStore(void);
-		void		SetDataStore(BMessage * a_message);
+		void		SetDataStore(BMessage * message);
 
 		status_t	Start(void);
 		status_t	Pause(bool a_do_block = TRUE, bigtime_t a_timeout = 0);
@@ -39,7 +39,7 @@
 		void		SnoozeUntil(bigtime_t a_microseconds, int a_timebase = B_SYSTEM_TIMEBASE);
 
 
-		status_t		GetInfo(thread_info * a_thread_info);
+		status_t		GetInfo(thread_info * thread_info);
 		thread_id		GetThread(void);
 		team_id			GetTeam(void);
 		char	*		GetName(void);
@@ -65,18 +65,18 @@
 		void		BeginUnit(void);	// acquire m_execute_cycle
 		void		EndUnit(void);	// release m_execute_cycle
 
-		BMessage	 *		m_thread_data_store;
+		BMessage	 *		fThreadDataStore;
 
 	private:
 
 		static status_t	private_thread_function(void * a_simple_thread_ptr);
 
-		thread_id		m_thread_id;
+		thread_id		fThreadId;
 
-		sem_id			m_execute_unit;	// acq./relase within tread_function.. For Pause()
+		sem_id			fExecuteUnit;	// acq./relase within tread_function.. For Pause()
 
-		bool			m_quit_requested;
-		bool			m_thread_is_paused;
+		bool			fQuitRequested;
+		bool			fThreadIsPaused;
 
 };
 




More information about the Haiku-commits mailing list