aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-02-05 17:36:10 +1000
committerDavid Walter Seikel2012-02-05 17:36:10 +1000
commit9ba142106365d4bfb7fff266bcc98801651e502e (patch)
treec2d519278819abcd2bb5ec4455dca2c0e0acb2d6 /libraries
parentMove the heavy lifting part of luaproc message sending to it's own function. (diff)
downloadSledjHamr-9ba142106365d4bfb7fff266bcc98801651e502e.zip
SledjHamr-9ba142106365d4bfb7fff266bcc98801651e502e.tar.gz
SledjHamr-9ba142106365d4bfb7fff266bcc98801651e502e.tar.bz2
SledjHamr-9ba142106365d4bfb7fff266bcc98801651e502e.tar.xz
White space fixes.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/luaproc/luaproc.c11
-rw-r--r--libraries/luaproc/luaproc.h5
2 files changed, 7 insertions, 9 deletions
diff --git a/libraries/luaproc/luaproc.c b/libraries/luaproc/luaproc.c
index 4770afd..8f1005e 100644
--- a/libraries/luaproc/luaproc.c
+++ b/libraries/luaproc/luaproc.c
@@ -70,7 +70,7 @@ struct stluaproc {
70}; 70};
71 71
72/****************************** 72/******************************
73* library functions prototypes 73* library functions prototypes
74******************************/ 74******************************/
75/* create a new lua process */ 75/* create a new lua process */
76static int luaproc_create_newproc( lua_State *L ); 76static int luaproc_create_newproc( lua_State *L );
@@ -157,7 +157,7 @@ luaproc luaproc_recycle_pop( void ) {
157 /* destroy node (but not associated luaproc) */ 157 /* destroy node (but not associated luaproc) */
158 list_destroy_node( n ); 158 list_destroy_node( n );
159 /* return associated luaproc */ 159 /* return associated luaproc */
160 return lp; 160 return lp;
161 } 161 }
162 162
163 /* free access to operate on recycle list */ 163 /* free access to operate on recycle list */
@@ -452,7 +452,7 @@ luaproc luaproc_dequeue_sender( channel chan ) {
452/* queue a luc process receiving a message without a matching sender */ 452/* queue a luc process receiving a message without a matching sender */
453void luaproc_queue_receiver( luaproc lp ) { 453void luaproc_queue_receiver( luaproc lp ) {
454 /* add the receiving process to this process' receive queue */ 454 /* add the receiving process to this process' receive queue */
455 list_add( channel_get_recvq( lp->chan ), list_new_node( lp )); 455 list_add( channel_get_recvq( lp->chan ), list_new_node( lp ));
456} 456}
457 457
458/* dequeue a lua process receiving a message with a sender match */ 458/* dequeue a lua process receiving a message with a sender match */
@@ -592,7 +592,7 @@ static int luaproc_send( lua_State *L ) {
592 luaproc_movevalues( L, dstlp->lstate ); 592 luaproc_movevalues( L, dstlp->lstate );
593 593
594 dstlp->args = lua_gettop( dstlp->lstate ) - 1; 594 dstlp->args = lua_gettop( dstlp->lstate ) - 1;
595 595
596 if ( sched_queue_proc( dstlp ) != LUAPROC_SCHED_QUEUE_PROC_OK ) { 596 if ( sched_queue_proc( dstlp ) != LUAPROC_SCHED_QUEUE_PROC_OK ) {
597 597
598 /* unlock channel access */ 598 /* unlock channel access */
@@ -801,7 +801,7 @@ static int luaproc_destroy_channel( lua_State *L ) {
801 pthread_mutex_t *chmutex; 801 pthread_mutex_t *chmutex;
802 pthread_cond_t *chcond; 802 pthread_cond_t *chcond;
803 const char *chname = luaL_checkstring( L, 1 ); 803 const char *chname = luaL_checkstring( L, 1 );
804 804
805 805
806 /* get exclusive access to operate on channels */ 806 /* get exclusive access to operate on channels */
807 pthread_mutex_lock( &mutex_channel ); 807 pthread_mutex_lock( &mutex_channel );
@@ -923,4 +923,3 @@ void luaproc_unlock_channel( channel chan ) {
923int luaproc_get_destroyworker( luaproc lp ) { 923int luaproc_get_destroyworker( luaproc lp ) {
924 return lp->destroyworker; 924 return lp->destroyworker;
925} 925}
926
diff --git a/libraries/luaproc/luaproc.h b/libraries/luaproc/luaproc.h
index d700e86..2f3ed3f 100644
--- a/libraries/luaproc/luaproc.h
+++ b/libraries/luaproc/luaproc.h
@@ -71,16 +71,15 @@ luaproc luaproc_create_sched( char *code );
71void luaproc_register_funcs( lua_State *L ); 71void luaproc_register_funcs( lua_State *L );
72 72
73/* allow registering of luaproc's functions in c main prog */ 73/* allow registering of luaproc's functions in c main prog */
74void luaproc_register_lib( lua_State *L ); 74void luaproc_register_lib( lua_State *L );
75 75
76/* queue a luaproc that tried to send a message */ 76/* queue a luaproc that tried to send a message */
77void luaproc_queue_sender( luaproc lp ); 77void luaproc_queue_sender( luaproc lp );
78
79 78
80const char *sendToChannel(const char *chname, const char *message); 79const char *sendToChannel(const char *chname, const char *message);
81 80
82/* queue a luaproc that tried to receive a message */ 81/* queue a luaproc that tried to receive a message */
83void luaproc_queue_receiver( luaproc lp ); 82void luaproc_queue_receiver( luaproc lp );
84 83
85/* unlock a channel's access */ 84/* unlock a channel's access */
86void luaproc_unlock_channel( channel chan ); 85void luaproc_unlock_channel( channel chan );