summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-06 18:48:20 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-03-06 18:48:20 (GMT)
commite385ba8adb0c77fea20c58c45b966193c23a4570 (patch)
tree6d1d45f00516af6eda4e4959c730970f37d5c7b9
parente1a31a44c946d58a1b4654e5daa2d10d9c6f881d (diff)
downloaduscxml-e385ba8adb0c77fea20c58c45b966193c23a4570.zip
uscxml-e385ba8adb0c77fea20c58c45b966193c23a4570.tar.gz
uscxml-e385ba8adb0c77fea20c58c45b966193c23a4570.tar.bz2
Fixed a concurrency related issue
-rw-r--r--apps/samples/vrml-server.scxml3
-rw-r--r--src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp10
2 files changed, 10 insertions, 3 deletions
diff --git a/apps/samples/vrml-server.scxml b/apps/samples/vrml-server.scxml
index bf0e4f6..7c257f5 100644
--- a/apps/samples/vrml-server.scxml
+++ b/apps/samples/vrml-server.scxml
@@ -21,7 +21,8 @@
'_' + numPattern + // z
'_' + numPattern + // width
'_' + numPattern + // height
- '_(off|on)' + ')\\..*$'); // autorotate
+ '_(off|on)' + // autorotate
+ ')\\.\\w+$'); // end
/**
* Transform a file we found into a processed or model struct
diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
index 2fa2877..fbc244a 100644
--- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
+++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGConverter.cpp
@@ -502,9 +502,15 @@ void OSGConverter::dumpMatrix(const osg::Matrix& m) {
}
void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image, const unsigned int context_id) {
- bool success = osgDB::writeImageFile(image, _filename);
+
+ bool success = osgDB::writeImageFile(image, _filename + ".tmp");
if (success) {
- _converter->reportSuccess(_req);
+ int err = rename(std::string(_filename + ".tmp").c_str(), _filename.c_str());
+ if (err) {
+ _converter->reportFailure(_req);
+ } else {
+ _converter->reportSuccess(_req);
+ }
} else {
_converter->reportFailure(_req);
}