Commit graph

1927 commits

Author SHA1 Message Date
Mark Pictor
ba74c53ca0 for std::thread, change reference args to pointers
I ran into an error "...error: no type named 'type' in class std::result_of..."
Google led me to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57716
and I eliminated the error by changing references to pointers as described at
http://stackoverflow.com/questions/15235885/invalid-initialization-of-non-const-reference-with-c11-thread
2014-08-21 20:27:36 -04:00
hoiji09
5dc00ba03f Merge remote-tracking branch 'origin/master' into hj/thread-safety
Conflicts:
	src/clstepcore/instmgr.cc
2014-08-18 19:37:13 +05:30
hoiji09
1265e0c110 Added exit(success/fail) in thread-safety test 2014-08-18 17:45:31 +05:30
hoiji09
e73ad4df1c instMgrAdapter took dependency on sc_thread
lazyTypes.h was also modified. HAVE_STD_THREAD macros were removed from cllazyfile library *.cc and *.h since classes sc_thread and sc_mutex internally handles the macros.
2014-08-18 17:28:30 +05:30
hoiji09
f0fdfd706f Added class sc_thread in sc_thread.h 2014-08-18 17:25:58 +05:30
hoiji09
bac1435936 Added sc_thread.h in clutils
This acts like a wrapper to some of the thread functionalities (like get_id()) which is being used in stepcode. If the compiler does not supports thread functionalities then this class provides dummy types and functionalities.
2014-08-18 17:00:01 +05:30
hoiji09
54457e567a Utilized sc_mutex in cllazyfile
Earlier std::mutex was being used. It was replaces with sc_mutex which acts like a wrapper to std::mutex
2014-08-18 16:56:06 +05:30
hoiji09
2aa936b601 Corrected a coment sc_mutex.h 2014-08-18 14:08:18 +05:30
hoiji09
85a248a50a Added NO_REGISTRY Macro to lazy_thread_safety_test
lazy_thread_safety_test had 2 checks which were schema dependent. These checks are now wrapped in NO_REGISTRY macro.
2014-08-18 11:57:17 +05:30
Cliff Yapp
f72e01e610 Apply BRL-CAD change r61607 - Harden verify_generated.cmake.in to odd pathnames 2014-08-17 23:25:03 -04:00
Cliff Yapp
7531579d39 Update generated expscan.c file 2014-08-17 23:23:02 -04:00
Cliff Yapp
2ff6f4b434 Apply BRL-CAD change r61104 from brlcad - remove the misspelled readme markdown file that only contains the word 'Howto' 2014-08-17 23:12:37 -04:00
Cliff Yapp
f357ef4c83 Apply BRL-CAD change r61065 - The insertion mechanism for the sortedMaster array performed very badly in the case where a large file has a batch of low-id-number entities towards the end of the file. Tossing in std::map in place of that array avoids the bad corner case, but we may pay a performance penalty in other situations - depending on what the bottle necks are, this may be work revisiting. For now, this seems to work well enough. 2014-08-17 23:09:50 -04:00
Cliff Yapp
752f976475 Suppress CMake warning 26 - need to figure out the 'right' approach eventually, but for now this is needed with CMake 3.0 2014-08-17 23:04:24 -04:00
Cliff Yapp
03dbb8ee9f Apply BRL-CAD change r58740 from tbrowder2 - fix typo 2014-08-17 22:57:17 -04:00
Cliff Yapp
3e51af51b4 Apply BRL-CAD change r58523 from n_reed - include ios header for std::ios namespace; fixes 'symbol not found' in exp2cxx on os x 2014-08-17 22:55:44 -04:00
Cliff Yapp
87e1f9948c Apply BRL-CAD change r58222 from tbrowder2 - added FIXME to warn of error with tightned standards 2014-08-17 22:54:01 -04:00
Cliff Yapp
b905bec990 Apply BRL-CAD change r58172 from tbrowder2 - correct grammar 2014-08-17 22:52:56 -04:00
hoiji09
03981d27e0 One more subclass of SDAI__set
Adding the Remove( SDAI_ptr ) API to SDAI__set made SDAI_Application_instance__set a candidate for inheriting common logic from SDAI__set.
Note: This class was already made thread safe in one of the previous commits. This commit only removes the now apparent duplicate code.
2014-08-15 23:25:32 +05:30
hoiji09
f26cb0457d Added SDAI__set::Remove( SDAI_ptr ) function
The semantics of this function would be similar to SDAI__set::Remove( SDAI__set::Index( SDAI_ptr ) ). The only difference would be that in the new function both the operations are done under a single lock.
Wherever the old Remove( Index( SDAI_ptr ) ) code snippet was found, it was replaced by the new Remove( SDAI_ptr ) function.
2014-08-15 22:56:49 +05:30
hoiji09
42d71188fc Made SDAI__set thread safe
This was done by introducing a mutex in the SDAI__set class.
2014-08-15 22:20:09 +05:30
hoiji09
40c3a1c33b Made use of sdaiSet
The classes in cldai which were chosen to inherit from sdaiSet were: SDAI_DAObject__set, SDAI_Entity_extent__set and SDAI_Model_contents__list.
2014-08-15 21:46:48 +05:30
hoiji09
fa75e8cedd Added class sdaiSet in cldai library
This class will act as a superclass of few other classes in the same library, hence will contain the common logic of its subclasses.
2014-08-15 21:41:50 +05:30
hoiji09
b17bcbdaf0 Removed warning from SDAI_instance__set commit 2014-08-15 20:41:30 +05:30
hoiji09
731673f827 Thread safety in SDAI_Application_instance__set
Done by introducing a recursive_mutex in the SDAI_Application_instance__set class.
2014-08-13 21:06:26 +05:30
hoiji09
e941244617 Added a comment about thread safety in STEPfile 2014-08-13 11:15:41 +05:30
hoiji09
91efe7c0e5 Safe attributes iteration in STEPfile 2014-08-13 10:55:12 +05:30
hoiji09
02b41416fb Safe InstMgr iteration in STEPfile
Variables of class InstMgr were being iterated upon in class STEPfile through the variables _instances (including its get function instances()) and _headerInstances. The mtx defined in InstMgr was invoked to make them safe.
2014-08-13 10:44:34 +05:30
hoiji09
9cbe6d1dd9 GetApplication_instanceFromFileId in InstMgr class
The SDAI_Application_instance * GetApplication_instance( MgrNode * ) and MgrNode * FindFileId( int ) methods of class InstMgr were often being used together in the class STEPfile. Hence a special function was created in class InstMgr of the form SDAI_Application_instance * GetApplication_instanceFromFileId( int ) which would take care of locking and consistency issues. This function was then used in STEPfile.
2014-08-13 10:19:24 +05:30
hoiji09
a3ce139347 Protected _headerId in STEPfile (cleditor)
_headerId is a counter used in STEPfile class. Its value can change in ReadHeader and ReadExchangeFile methods. Hence a mutex was introduced in order to protect it.
2014-08-13 10:07:32 +05:30
hoiji09
e3fbc14282 Removed istream *in2 from STEPfile::AppendFile
Originally For the second pass a new istream (in2) was being created and the .step file was being opened again. This was prevented by directing the original istream (in) to the beggining of the .step file.
2014-08-10 22:44:11 +05:30
hoiji09
9f24e3ef64 Optimized ReadReal
Replaced calls to input stream peek & get with judicious use of get.
2014-08-08 20:10:05 +05:30
hoiji09
7f653188c4 Converted GetKeyword to FillKeyword
In the original function a static string was being used. The dependency on the static string was removed by passing a string as a parameter from the caller to callee, so that the function could operate without worrying about thread safety.
The function name change mimics the change in the semantics of the function.
2014-08-08 11:04:21 +05:30
hoiji09
3c616f1455 Made DirObj of clutils thread safe
This was achieved introducing a mutex in the DirObj class. Course-Level (fat) Locking was done only in publically accessed function.
2014-08-06 20:36:25 +05:30
hoiji09
376dc4a482 Thread safety in CmdMgr of cleditor 2014-08-06 20:32:52 +05:30
hoiji09
0fe8bc3a91 Made ReplicateList in cleditor thread safe
Used mtxP of the superclass SingleLinkList to ensure thread safety
2014-08-06 20:31:25 +05:30
hoiji09
dc5a00f0ea Thread Safety in ComplexCollect
A mutex was introduced to proctect the counter and the pointer to clists.
The insert and remove functions were tricky to make thread safe as clists may or may-not have been initialized. Hand-over-hand locking was used.
2014-08-03 00:51:47 +05:30
hoiji09
27f781477c Thread safety in ComplexList
Like the classes before, used sharedMtxP to protect the EntNode list whenver it was being iterated upon.
Also added a public mutex to protect the public next pointer. Resposibilty of using it will fall to the class which is using next pointer (ComplexCollect)
2014-08-03 00:19:22 +05:30
hoiji09
1095f7346d Thread safety in OrList
Similar to AndList. However the mutex belonging to the superclass EntList was used to protect various counters (choiceCount, choice) used by OrList
2014-08-03 00:10:18 +05:30
hoiji09
3c848a5d2b Thread safety in Join-, And-, AndOr- List
sharedMtxP of EntNode class was invoked to keep the list of EntNode consistent whenever the EntNode list was being used multiple times in a function
2014-08-02 23:36:36 +05:30
hoiji09
79c9901662 Thread safety in MultList
The mutex defined in the superclass EntList was used in the function appendList.
2014-08-02 23:23:54 +05:30
hoiji09
07448b77d6 Thread Safety in SimpleList
Used sharedMtxP defined in EntNode class to protect EntNode list structure which was being accessed in functions of SimpleList class
2014-08-02 23:01:21 +05:30
hoiji09
0a45ce2aa5 Thread safety in EntList.
Under the assumptions that an EntList object cannot be inserted in between two EntList objects and cannot be removed from a list of EntList objects, making this class thread safe became trivially easy.
One mutex per EntList object was introduced to support appending of EntList objects. As this feature would be used by its subclass (MultList)
2014-08-02 22:32:00 +05:30
Cliff Yapp
63298df542 Until we reach a final decision on what to do about the schema_scanner, handle the .exe case 2014-08-01 21:04:23 -04:00
Cliff Yapp
319a8ab59d Only set a property on lazy_test-static if it is present as a target. 2014-08-01 21:01:37 -04:00
Cliff Yapp
607f732671 Need the NO_REGISTRY flag for the static version of this target as well. 2014-08-01 07:24:27 -04:00
Cliff Yapp
e649757417 Install schema headers in locations that match the build tree hierarchy, so include directives will work both with in-build-tree and installed stepcode layouts. 2014-07-31 21:26:57 -04:00
hoiji09
3fdbe460f1 Made STEPcomplex thread safe
The assumption used was that STEPcomplex class wont in future provide an API through which threads can remove / insert a STEPcomplex node.
Three already declared mutexes were used in for this purpose:
(1) A recursive mutex for each STEPcomplex node (borrowed from the superclass SDAI_Application_instance)
(2) A recursive mutex belonging to AttrDescriptorList class (originally defined in SingleLinkList class)
(3) A recursive shared mutex belonging to EntNode class.

The fixed order between the locks was: (2) > (1). (3) was independent.
2014-07-24 23:06:21 +05:30
hoiji09
2cabefa944 Minor STEPcomplex optimization
Collapsed an if condition into a while condition without changing the semantics
2014-07-24 22:47:23 +05:30
hoiji09
7233d604a1 Fixed locking in sdaiApplication_instance.cc
The STEPattributeList data was being iterated and modiefied by the SDAI_Application_instance class without invoking the mutex of the STEPattribute class. This was fixed in this commit.
2014-07-24 22:31:26 +05:30