some style fixes

This commit is contained in:
ilsimo
2007-04-15 21:03:05 +00:00
parent 4175d2d8be
commit 7dcf60f8a0
3 changed files with 33 additions and 33 deletions
+17 -17
View File
@@ -43,7 +43,7 @@ int lock_fork_waiting_count; /* threads suspended until the fork finish
sem_t lock_socket; sem_t lock_socket;
void DEFAULT_CC void DEFAULT_CC
lock_init() lock_init(void)
{ {
/* initializing socket lock */ /* initializing socket lock */
sem_init(&lock_socket, 0, 1); sem_init(&lock_socket, 0, 1);
@@ -51,11 +51,11 @@ lock_init()
/* initializing chain lock */ /* initializing chain lock */
pthread_mutexattr_init(&lock_chain_attr); pthread_mutexattr_init(&lock_chain_attr);
pthread_mutex_init(&lock_chain, &lock_chain_attr); pthread_mutex_init(&lock_chain, &lock_chain_attr);
/* initializing config lock */ /* initializing config lock */
pthread_mutexattr_init(&lock_config_attr); pthread_mutexattr_init(&lock_config_attr);
pthread_mutex_init(&lock_config, &lock_config_attr); pthread_mutex_init(&lock_config, &lock_config_attr);
/* initializing fork lock */ /* initializing fork lock */
pthread_mutexattr_init(&lock_fork_attr); pthread_mutexattr_init(&lock_fork_attr);
pthread_mutex_init(&lock_chain, &lock_fork_attr); pthread_mutex_init(&lock_chain, &lock_fork_attr);
@@ -71,7 +71,7 @@ lock_init()
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_chain_acquire() lock_chain_acquire(void)
{ {
/*lock the chain*/ /*lock the chain*/
LOG_DBG("lock_chain_acquire()",0); LOG_DBG("lock_chain_acquire()",0);
@@ -80,7 +80,7 @@ lock_chain_acquire()
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_chain_release() lock_chain_release(void)
{ {
/*unlock the chain*/ /*unlock the chain*/
LOG_DBG("lock_chain_release()",0); LOG_DBG("lock_chain_release()",0);
@@ -89,7 +89,7 @@ lock_chain_release()
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_socket_acquire() lock_socket_acquire(void)
{ {
/* lock socket variable */ /* lock socket variable */
LOG_DBG("lock_socket_acquire()",0); LOG_DBG("lock_socket_acquire()",0);
@@ -98,7 +98,7 @@ lock_socket_acquire()
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_socket_release() lock_socket_release(void)
{ {
/* unlock socket variable */ /* unlock socket variable */
LOG_DBG("lock_socket_release()",0); LOG_DBG("lock_socket_release()",0);
@@ -107,7 +107,7 @@ lock_socket_release()
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_fork_request() lock_fork_request(void)
{ {
/* lock mutex */ /* lock mutex */
pthread_mutex_lock(&lock_fork); pthread_mutex_lock(&lock_fork);
@@ -118,14 +118,14 @@ lock_fork_request()
} }
lock_fork_forkers_count++; lock_fork_forkers_count++;
pthread_mutex_unlock(&lock_fork); pthread_mutex_unlock(&lock_fork);
/* we wait to be allowed to fork() */ /* we wait to be allowed to fork() */
sem_wait(&lock_fork_req); sem_wait(&lock_fork_req);
} }
/******************************************************************************/ /******************************************************************************/
void DEFAULT_CC void DEFAULT_CC
lock_fork_release() lock_fork_release(void)
{ {
pthread_mutex_lock(&lock_fork); pthread_mutex_lock(&lock_fork);
lock_fork_forkers_count--; lock_fork_forkers_count--;
@@ -135,7 +135,7 @@ lock_fork_release()
{ {
sem_post(&lock_fork_req); sem_post(&lock_fork_req);
} }
for (;lock_fork_waiting_count > 0; lock_fork_waiting_count--) for (;lock_fork_waiting_count > 0; lock_fork_waiting_count--)
{ {
/* waking up the other processes */ /* waking up the other processes */
@@ -156,7 +156,7 @@ lock_fork_critical_section_end(int blocking)
{ {
lock_fork_blockers_count--; lock_fork_blockers_count--;
} }
/* if there's someone who wants to fork and we're the last blocking */ /* if there's someone who wants to fork and we're the last blocking */
/* then we let him go */ /* then we let him go */
if ((lock_fork_blockers_count == 0) && (lock_fork_forkers_count>0)) if ((lock_fork_blockers_count == 0) && (lock_fork_forkers_count>0))
@@ -168,22 +168,22 @@ lock_fork_critical_section_end(int blocking)
/******************************************************************************/ /******************************************************************************/
int DEFAULT_CC int DEFAULT_CC
lock_fork_critical_section_start() lock_fork_critical_section_start(void)
{ {
LOG_DBG("lock_fork_critical_secection_start()",0); LOG_DBG("lock_fork_critical_secection_start()",0);
do do
{ {
pthread_mutex_lock(&lock_fork); pthread_mutex_lock(&lock_fork);
/* someone requested to fork */ /* someone requested to fork */
if (lock_fork_forkers_count > 0) if (lock_fork_forkers_count > 0)
{ {
lock_fork_waiting_count++; lock_fork_waiting_count++;
pthread_mutex_unlock(&lock_fork); pthread_mutex_unlock(&lock_fork);
/* we wait until the fork finishes */ /* we wait until the fork finishes */
sem_wait(&lock_fork_wait); sem_wait(&lock_fork_wait);
} }
else else
{ {
+12 -12
View File
@@ -31,7 +31,7 @@
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_init(); lock_init(void);
/** /**
* *
@@ -39,7 +39,7 @@ lock_init();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_chain_acquire(); lock_chain_acquire(void);
/** /**
* *
@@ -47,7 +47,7 @@ lock_chain_acquire();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_chain_release(); lock_chain_release(void);
/** /**
* *
@@ -55,7 +55,7 @@ lock_chain_release();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_cfg_acquire(); lock_cfg_acquire(void);
/** /**
* *
@@ -63,7 +63,7 @@ lock_cfg_acquire();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_cfg_release(); lock_cfg_release(void);
/** /**
* *
@@ -71,7 +71,7 @@ lock_cfg_release();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_socket_acquire(); lock_socket_acquire(void);
/** /**
* *
@@ -79,7 +79,7 @@ lock_socket_acquire();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_socket_release(); lock_socket_release(void);
/** /**
* *
@@ -87,7 +87,7 @@ lock_socket_release();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_fork_request(); lock_fork_request(void);
/** /**
* *
@@ -95,21 +95,21 @@ lock_fork_request();
* *
*/ */
void DEFAULT_CC void DEFAULT_CC
lock_fork_release(); lock_fork_release(void);
/** /**
* *
* @brief starts a section that is critical for forking * @brief starts a section that is critical for forking
* *
* starts a section that is critical for forking, that is noone can fork() * starts a section that is critical for forking, that is noone can fork()
* while i'm in a critical section. But if someone wanted to fork we have * while i'm in a critical section. But if someone wanted to fork we have
* to wait until he finishes with lock_fork_release() * to wait until he finishes with lock_fork_release()
* *
* @return * @return
* *
*/ */
int DEFAULT_CC int DEFAULT_CC
lock_fork_critical_section_start(); lock_fork_critical_section_start(void);
/** /**
* *
+4 -4
View File
@@ -22,7 +22,7 @@
* @file thread.h * @file thread.h
* @brief thread stuff... * @brief thread stuff...
* @author Simone Fedele * @author Simone Fedele
* *
*/ */
#ifndef THREAD_H #ifndef THREAD_H
@@ -36,7 +36,7 @@
* *
*/ */
int DEFAULT_CC int DEFAULT_CC
thread_sighandler_start(); thread_sighandler_start(void);
/** /**
* *
@@ -44,7 +44,7 @@ thread_sighandler_start();
* *
*/ */
int DEFAULT_CC int DEFAULT_CC
thread_session_update_start(); thread_session_update_start(void);
/** /**
* *
@@ -52,6 +52,6 @@ thread_session_update_start();
* *
*/ */
int DEFAULT_CC int DEFAULT_CC
thread_scp_start(); thread_scp_start(int skt);
#endif #endif