mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-08-13 19:37:10 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
68
vendor/POCO/Foundation/samples/Activity/src/Activity.cpp
vendored
Normal file
68
vendor/POCO/Foundation/samples/Activity/src/Activity.cpp
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
//
|
||||
// Activity.cpp
|
||||
//
|
||||
// This sample demonstrates the Activity class.
|
||||
//
|
||||
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/Activity.h"
|
||||
#include "Poco/Thread.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using Poco::Activity;
|
||||
using Poco::Thread;
|
||||
|
||||
|
||||
class ActivityExample
|
||||
{
|
||||
public:
|
||||
ActivityExample():
|
||||
_activity(this, &ActivityExample::runActivity)
|
||||
{
|
||||
}
|
||||
|
||||
void start()
|
||||
{
|
||||
_activity.start();
|
||||
}
|
||||
|
||||
void stop()
|
||||
{
|
||||
_activity.stop();
|
||||
_activity.wait();
|
||||
}
|
||||
|
||||
protected:
|
||||
void runActivity()
|
||||
{
|
||||
while (!_activity.isStopped())
|
||||
{
|
||||
std::cout << "Activity running." << std::endl;
|
||||
Thread::sleep(250);
|
||||
}
|
||||
std::cout << "Activity stopped." << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
Activity<ActivityExample> _activity;
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ActivityExample example;
|
||||
example.start();
|
||||
Thread::sleep(2000);
|
||||
example.stop();
|
||||
|
||||
example.start();
|
||||
example.stop();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user