History

TimeSeriesPlatformLibrary: Simplfied data publisher threading implementations.

J. Ritchie Carroll committed 7 years ago

Commit 68c05e01 parent aea1d009 files · +219 −232Browse files

Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/InstancePublish.cpp (1 of 9 files). Show all

Unified · Split

Source/Libraries/TimeSeriesPlatformLibrary/Samples/InstancePublish.cpp+9−11
@@ -35,7 +35,6 @@ PublisherHandler* Publisher[TotalInstances]; · 34 unmodified lines
3535
3636 int main(int argc, char* argv[])
3737 {
38− string hostname;
3938 uint16_t port;
4039
4140 // Ensure that the necessary
@@ -56,28 +55,27 @@ int main(int argc, char* argv[]) · 14 unmodified lines
5655 // Maintain the life-time of PublisherHandler instances within main
5756 PublisherHandler* publisher = new PublisherHandler("Publisher " + ToString(i + 1), port + i, false);
5857
59− // Set second publisher to only allow one connection
60− if (i == 1)
61− publisher->SetMaximumAllowedConnections(1);
58+ // Set second publisher to only allow one connection
59+ if (i == 1)
60+ publisher->SetMaximumAllowedConnections(1);
6261
63− publisher->Start();
64− Publisher[i] = publisher;
62+ publisher->Start();
63+ Publisher[i] = publisher;
6564 }
6665
6766 // Wait until the user presses enter before quitting.
6867 string line;
6968 getline(cin, line);
7069
71− // Shutdown publisher instances
70+ // Stop publisher instances - this stops publication
7271 for (uint32_t i = 0; i < TotalInstances; i++)
7372 Publisher[i]->Stop();
7473
75− // Disconnect the publisher to stop background threads.
76− cout << "Disconnected." << endl;
77−
78− // Delete publisher instances
74+ // Delete publisher instances - this closes sockets
7975 for (uint32_t i = 0; i < TotalInstances; i++)
8076 delete Publisher[i];
8177
78+ cout << "Publishers stopped." << endl;
79+
8280 return 0;
8381 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t