[Pntool-developers] SF.net SVN: pntool:[262] present_version/pnheaders
Brought to you by:
compaqdrew,
miordache
From: <mio...@us...> - 2011-08-27 01:53:27
|
Revision: 262 http://pntool.svn.sourceforge.net/pntool/?rev=262&view=rev Author: miordache Date: 2011-08-27 01:53:21 +0000 (Sat, 27 Aug 2011) Log Message: ----------- Modified Paths: -------------- old_versions/2011/newcodegen/plantCompiler.c old_versions/2011/newcodegen/spcommon.h present_version/newcodegen/plantCompiler.c present_version/newcodegen/spcommon.h present_version/pnheaders/main_function2.c Modified: old_versions/2011/newcodegen/plantCompiler.c =================================================================== --- old_versions/2011/newcodegen/plantCompiler.c 2011-08-04 23:18:35 UTC (rev 261) +++ old_versions/2011/newcodegen/plantCompiler.c 2011-08-27 01:53:21 UTC (rev 262) @@ -24,8 +24,7 @@ f = fopen(s, "r"); if(!f) - merror(0,"CODEGEN: Unable to find template file %s in current directory",\ - s); + merror(0,"Unable to find the template file %s in the current directory. Copy spcommon.h and the template files from newcodegen/ to the working directory.", s); return f; } Modified: old_versions/2011/newcodegen/spcommon.h =================================================================== --- old_versions/2011/newcodegen/spcommon.h 2011-08-04 23:18:35 UTC (rev 261) +++ old_versions/2011/newcodegen/spcommon.h 2011-08-27 01:53:21 UTC (rev 262) @@ -80,6 +80,33 @@ } +int ___send_msg(const void* ___pdata, int ___n, int pwrite, \ + void (*dbgfn) (char* ___str, ...)); + +int ___get_msg(int ___read_end, void *p___ms, int ___n,\ + void (*dbgfn) (char* ___str, ...)); + +inline void ___send_exit_notification(struct ___thread_data* ___pthr); + +int RequestToFire(int ___n, struct ___trans* ___TRV, \ + struct ___thread_data *___pthr, \ + void (*dbgfn) (char* ___str, ...)); + +void AnnounceFiring(int ___tr, struct ___trans* ___TRV, \ + struct ___thread_data *___pthr); + +int ___NextState(struct ___trans* ___TRV, const char* ___TRVinfo, \ + int ___cplace, int ___n, int* p___finish, struct \ + ___thread_data *___pthr, void (*dbgfn) (char* ___str, ...)); + +void ___TRShuffle(struct ___trans* ___TRV, int ___n); + +inline int ___AddToTR(struct ___trans* ___TRV, int ___i, char ___flag, int ___p, \ + int ___l, int ___t, int ___a); + + + + #ifndef ___THREAD //thread code must not repeat definitions of supervisor code void ___debugInfoSub(int ___type, int ___id, char* ___vname, char* ___str, va_list ___param) { @@ -202,6 +229,11 @@ } +#ifdef ___SUPERVISOR +static pthread_mutex_t ___mtx = PTHREAD_MUTEX_INITIALIZER; +#endif + + int RequestToFire(int ___n, struct ___trans* ___TRV, \ struct ___thread_data *___pthr, \ void (*dbgfn) (char* ___str, ...)) { @@ -217,7 +249,21 @@ static int ___req_id = 0; struct ___msg ___ms; +#ifdef ___SUPERVISOR + pthread_mutex_lock(&___mtx); // one thread at a time may change ___req_id + // The lock: a temorary solution. It would be better to assigne a ___req_id + // to each thread and avoid in this way the mutex. There is no need to have + // a unique ___req_id for all threads. +#endif + ___req_id++; + if(!___req_id) + ___req_id = 1; + +#ifdef ___SUPERVISOR + pthread_mutex_unlock(&___mtx); +#endif + ___ms.type = ___FIRING_REQUEST; ___ms.id = ___pthr->id; ___ms.req_id = ___req_id; Modified: present_version/newcodegen/plantCompiler.c =================================================================== --- present_version/newcodegen/plantCompiler.c 2011-08-04 23:18:35 UTC (rev 261) +++ present_version/newcodegen/plantCompiler.c 2011-08-27 01:53:21 UTC (rev 262) @@ -24,8 +24,7 @@ f = fopen(s, "r"); if(!f) - merror(0,"CODEGEN: Unable to find template file %s in current directory",\ - s); + merror(0,"Unable to find the template file %s in the current directory. Copy spcommon.h and the template files from newcodegen/ to the working directory.", s); return f; } Modified: present_version/newcodegen/spcommon.h =================================================================== --- present_version/newcodegen/spcommon.h 2011-08-04 23:18:35 UTC (rev 261) +++ present_version/newcodegen/spcommon.h 2011-08-27 01:53:21 UTC (rev 262) @@ -80,6 +80,33 @@ } +int ___send_msg(const void* ___pdata, int ___n, int pwrite, \ + void (*dbgfn) (char* ___str, ...)); + +int ___get_msg(int ___read_end, void *p___ms, int ___n,\ + void (*dbgfn) (char* ___str, ...)); + +inline void ___send_exit_notification(struct ___thread_data* ___pthr); + +int RequestToFire(int ___n, struct ___trans* ___TRV, \ + struct ___thread_data *___pthr, \ + void (*dbgfn) (char* ___str, ...)); + +void AnnounceFiring(int ___tr, struct ___trans* ___TRV, \ + struct ___thread_data *___pthr); + +int ___NextState(struct ___trans* ___TRV, const char* ___TRVinfo, \ + int ___cplace, int ___n, int* p___finish, struct \ + ___thread_data *___pthr, void (*dbgfn) (char* ___str, ...)); + +void ___TRShuffle(struct ___trans* ___TRV, int ___n); + +inline int ___AddToTR(struct ___trans* ___TRV, int ___i, char ___flag, int ___p, \ + int ___l, int ___t, int ___a); + + + + #ifndef ___THREAD //thread code must not repeat definitions of supervisor code void ___debugInfoSub(int ___type, int ___id, char* ___vname, char* ___str, va_list ___param) { @@ -202,6 +229,11 @@ } +#ifdef ___SUPERVISOR +static pthread_mutex_t ___mtx = PTHREAD_MUTEX_INITIALIZER; +#endif + + int RequestToFire(int ___n, struct ___trans* ___TRV, \ struct ___thread_data *___pthr, \ void (*dbgfn) (char* ___str, ...)) { @@ -217,7 +249,21 @@ static int ___req_id = 0; struct ___msg ___ms; +#ifdef ___SUPERVISOR + pthread_mutex_lock(&___mtx); // one thread at a time may change ___req_id + // The lock: a temorary solution. It would be better to assigne a ___req_id + // to each thread and avoid in this way the mutex. There is no need to have + // a unique ___req_id for all threads. +#endif + ___req_id++; + if(!___req_id) + ___req_id = 1; + +#ifdef ___SUPERVISOR + pthread_mutex_unlock(&___mtx); +#endif + ___ms.type = ___FIRING_REQUEST; ___ms.id = ___pthr->id; ___ms.req_id = ___req_id; Modified: present_version/pnheaders/main_function2.c =================================================================== --- present_version/pnheaders/main_function2.c 2011-08-04 23:18:35 UTC (rev 261) +++ present_version/pnheaders/main_function2.c 2011-08-27 01:53:21 UTC (rev 262) @@ -172,7 +172,7 @@ TrData** TInf; // These are flags - unsigned char no_main = 0, signals = 0, sleep = 1, single_ch = 0; + unsigned char no_main = 0, signals = 0, sleep = 0, single_ch = 0; char help[] = "\ The program generates concurrency control code based on a specification file.\ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |