Re: [Cppcms-users] cppcms::service and system(..)
Brought to you by:
artyom-beilis
From: Christian G. <chr...@gm...> - 2012-09-22 20:16:15
|
Hi all, I have found some time and I am still working in this issue. The current state is the following: void Service::calibrate() { // valid session needed if (!session().is_set("user")) { BOOSTER_DEBUG("Service") << __func__ << ") not logged in"; return; } // only local host is allowed to do this if (request().remote_addr() != "127.0.0.1") { BOOSTER_DEBUG("Service") << __func__ << ") only on local host - called from " << request().remote_addr(); response().out() << "$.jGrowl(\"" << translate("Touch calibration only allowed on local host") << "\");" << "\n"; return; } response().out() << "$.jGrowl(\"" << translate("Starting calibration") << "...\");" << "\n"; BOOSTER_DEBUG("Service") << __func__ << ") doing action"; system("/opt/scripts/set-backlight.sh 0"); system("/opt/scripts/xcalibrate-touch.sh"); system("/opt/scripts/set-backlight.sh 100"); BOOSTER_DEBUG("Service") << __func__ << ") done"; } system("/opt/scripts/set-backlight.sh 0"); call works as expected but the whole web apps hangs at the next call: system("/opt/scripts/xcalibrate-touch.sh"); ----------------------------------------- #!/bin/bash # Invokes touch screen calibrator (x11) export DISPLAY=:0.0 BINARY=/opt/xinput_calibrator CALDATA=`$BINARY | grep 'Setting new calibration data:' | cut -d ":" -f 2 | tr -d ' ' | sed 's/,/ /g'` # if CALDATA is empty simply return if [ -z $CALDATA ]; then exit 0 fi # at the moment we store our axis_calib data in # the ID-Register. in some rare cases the # ID-Register is not accessable and we need a # fallback place to store our data. if [ -e /proc/idreg/axis_calib ]; then echo $CALDATA > /proc/idreg/axis_calib else echo $CALDATA > /home/vis/.axis_calib fi ----------------------------------------- xinput_calibrator can be found here https://github.com/tias/xinput_calibrator At the moment I am not sure whats wrong and how to debug it. maybe someone has an idea. --- Christian Gmeiner, MSc 2012/7/19 Artyom Beilis <art...@ya...>: > > > ----- Original Message ----- >> From: Christian Gmeiner <chr...@gm...> >> To: Artyom Beilis <art...@ya...>; cpp...@li... >> Cc: >> Sent: Thursday, July 19, 2012 3:58 PM >> Subject: Re: [Cppcms-users] cppcms::service and system(..) >> >> 2012/7/19 Artyom Beilis <art...@ya...>: >>> Make sure you do not call system from asynchronous application - call it >>> only from thread pool >>> >> >> The asynchronous application (javascript RPC) get the call to execute >> a bash script > > Asynchronous JavaScript or Asynchronously mounted CppCMS Application/RPC > > http://cppcms.com/wikipp/en/page/cppcms_1x_application_lifetime > > I mean if you mount an application asynchronously than you can't call system from there > as all I/O would be blocked by system > >> via system(..). How can I trigger the calling from thread pool? > > See in cppcms::service::thread_pool and cppcms::thread_pool documentation > > > > Artyom Beilis > > -------------- > CppCMS - C++ Web Framework: http://cppcms.com/ > CppDB - C++ SQL Connectivity: http://cppcms.com/sql/cppdb/ > > >> >> thanks >> --- >> Christian Gmeiner, MSc >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> Cppcms-users mailing list >> Cpp...@li... >> https://lists.sourceforge.net/lists/listinfo/cppcms-users >> > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Cppcms-users mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppcms-users |