static void addTempFile(std::string const & filename)
			{
				lock.lock();
				setupUnlocked();
				tmpfilenames.push_back(filename);
				lock.unlock();
			}
			static uint64_t addPipeHandler(SignalHandler * handler)
			{
				lock.lock();
				uint64_t const id = sigpipehandlers.size() ?  (sigpipehandlers.rbegin()->first+1) : 0;
				sigpipehandlers[id] = handler;
				lock.unlock();
				return id;
			}
			static void removeAllHandler(uint64_t const id)
			{
				lock.lock();
				siginthandlers.erase(siginthandlers.find(id));
				sigtermhandlers.erase(sigtermhandlers.find(id));
				sighuphandlers.erase(sighuphandlers.find(id));
				sigpipehandlers.erase(sigpipehandlers.find(id));
				lock.unlock();
			}
			static void setup()
			{
				lock.lock();
				if ( ! setupComplete )
				{
					setupTempFileRemovalRoutines();
					setupComplete = true;
				}
				lock.unlock();
			}
Beispiel #5
0
			value_type operator++(int)
			{
				#if defined(LIBMAUS2_HAVE_SYNC_OPS)
				return __sync_fetch_and_add(&cnt,1);
				#else
				value_type lcnt;
				lock.lock();
				lcnt = cnt++;
				lock.unlock();
				return lcnt;
				#endif
			}
Beispiel #6
0
			value_type get() const
			{
				#if defined(LIBMAUS2_HAVE_SYNC_OPS)
				return cnt;
				#else
				value_type lcnt;
				lock.lock();
				lcnt = cnt;
				lock.unlock();

				return lcnt;
				#endif
			}
Beispiel #7
0
			value_type operator+=(value_type const v)
			{
				#if defined(LIBMAUS2_HAVE_SYNC_OPS)
				return __sync_add_and_fetch(&cnt,v);
				#else
				value_type lcnt;
				lock.lock();
				cnt += v;
				lcnt = cnt;
				lock.unlock();
				return lcnt;
				#endif

			}
			static uint64_t addAllHandler(SignalHandler * handler)
			{
				lock.lock();
				uint64_t const pipeid = sigpipehandlers.size() ?  (sigpipehandlers.rbegin()->first+1) : 0;
				uint64_t const hupid = sighuphandlers.size() ?  (sighuphandlers.rbegin()->first+1) : 0;
				uint64_t const termid = sigtermhandlers.size() ?  (sigtermhandlers.rbegin()->first+1) : 0;
				uint64_t const intid = siginthandlers.size() ?  (siginthandlers.rbegin()->first+1) : 0;
				uint64_t const allid = std::max(std::max(pipeid,hupid),std::max(termid,intid));

				siginthandlers[allid] = handler;
				sigtermhandlers[allid] = handler;
				sighuphandlers[allid] = handler;
				sigpipehandlers[allid] = handler;
				
				lock.unlock();
				
				return allid;
			}
			static void setup()
			{
				lock.lock();
				setupUnlocked();
				lock.unlock();
			}
			static void removePipeHandler(uint64_t const id)
			{
				lock.lock();
				sigpipehandlers.erase(sigpipehandlers.find(id));
				lock.unlock();
			}
			static void removeHupHandler(uint64_t const id)
			{
				lock.lock();
				sighuphandlers.erase(sighuphandlers.find(id));
				lock.unlock();
			}
			static void removeTermHandler(uint64_t const id)
			{
				lock.lock();
				sigtermhandlers.erase(sigtermhandlers.find(id));
				lock.unlock();
			}
			void operator()(edge_type const * pa, uint64_t const n)
			{
				lock.lock();
				EL(pa,n);
				lock.unlock();
			}