Skip to content

Add SelectableEvent class#8

Merged
kcudnik merged 2 commits intosonic-net:masterfrom
kcudnik:event
Apr 21, 2016
Merged

Add SelectableEvent class#8
kcudnik merged 2 commits intosonic-net:masterfrom
kcudnik:event

Conversation

@kcudnik
Copy link
Copy Markdown
Contributor

@kcudnik kcudnik commented Apr 14, 2016

Purpose of this class is to allow threads waiting on selectable objects to be notified by user if for example user wants to finish thread, instead of periodic cause timeouts and check if thread needs to end

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Apr 18, 2016

can you add a unit test for this, which will also serve as an example for how to use this class. Since it has a new api notify(), not sure how to use it.

I assume we can no longer use Select::select() since it has the timeout hardcoded.

@kcudnik
Copy link
Copy Markdown
Contributor Author

kcudnik commented Apr 19, 2016

I will add unittest for this in next cr, also select() is method of Select class not Selectable, notify function is only provided to trgger select that some message arrived.

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Apr 19, 2016

I do like to see an example how to use this selectableevent class, especially the notify api. Do you have an example?


std::cout << "listening ... " << std::endl;

int result = s.select(&sel, &fd, 2000);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still have the timeout? I thought this selectevent can get rid of timeout which is the purpose?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i put timeout explicitly that if something goes wrong, it will not set value, and test will fails, since there is thread.join() and it will block unittest. Purpose of this test is to see if event notification is working correctly and it is.

@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Apr 21, 2016

ack

@kcudnik kcudnik merged commit cb8a690 into sonic-net:master Apr 21, 2016
@kcudnik kcudnik deleted the event branch April 21, 2016 19:58
zbud-msft added a commit to zbud-msft/sonic-swss-common that referenced this pull request Aug 3, 2022
* Add libzmq5 as dependency for ubuntu-20.04 build

* Add libzmq3-dev dependency to build script

Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>
zbud-msft added a commit that referenced this pull request Aug 24, 2022
* first cut

* first cut lib code with unit test

* save it just in case, as VM under risk

* partial update, as vm at risk

* intermediate saving

* First run code complete

* self review update

* partial compile

* In middle of compilation

* compiled OK

* common ut passes

* events_service unit tests complete

* test code in progress

* evens publish covere by unit test

* events 75% covered by UT

* subscribe UT done

* Drop internal readme

* Update upon self review - mostly on comments

* More on comments update

* minor fix of copy/paste error

* Comments update

* more comments

* minor updates; merged with master via shared

* Per review comments

* minor updates

* minor: name change for a typedef

* Added EXIT code

* Minor name change; Enabled py build for events

* Minor signature update to adapt to SWIG generated python

* Made zmq send & receive thread safe

* temp commit to enable merge

* removed hacks; Added set log level API

* Minor signature change

* Added unit test for C wrap

* Corrected per review comments; Addede log message for published events

* minor updates;no logical code changes

* corrected per review comments; Added accidentally removed test

* Added back accidentally removed test code file

* retire runtime id on deinit

* restore accidental removal

* Switched to shared_ptr per review comments

* minor non logical code changes

* fix syntax

* few follow up changes for bare ptr to shared ptr conversion

* send event as JSON string

* syntax

* syntax

* syntax

* syntax

* syntax

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* changing wrap signature to use struct instead of JSON string

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* compile fix

* Add libzmq5 as dependency for ubuntu-20.04 build (#7)

Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>

* Modify azp (#8)

* Add libzmq5 as dependency for ubuntu-20.04 build

* Add libzmq3-dev dependency to build script

Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>

* Modify azp (#9)

* Add libzmq5 as dependency for ubuntu-20.04 build

* Add libzmq3-dev dependency to build script

* Add uuid-dev and libboost-serialization-dev dependencies

Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>

* Modify azp (#10)

* Add libzmq5 as dependency for ubuntu-20.04 build

* Add libzmq3-dev dependency to build script

* Add uuid-dev and libboost-serialization-dev dependencies

* Add dependencies for bazel build

Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>

* compile errors

* compile errors

* Compile error from Ubuntu

* drop unused macro

* compile fix

* compile fix

* remove pedantic

* restored ABORT_IF_NOT

* revert flag add

* comments correction

* Log every published event

* Install dependencies for vstest (#15)

* Install deps vstest (#16)

* Install dependencies for vstest

* Add comments

* Install deps vstest (#17)

* Install dependencies for vstest

* Add comments

* Correct lib spelling

* Added LINGER timeout to service sockets

* Added heartbeat

* compile fix

* compile fix

* compile fix

* set LINGER_TIMEOUT before connect/bind

* Add global options

* Add global options

* Add global options

* Add global options

* Add global options

* Add global options

* Add global options

* Add global options

* Add global options

* added define

* Moved C API to C header file

* minor upates

* minor upates

* Updated comments

* comments update

* comments update

* Fix build issue

* Modify comment

* Modify comment

* Modify comment

* Modify comment

* Modify comment

* Modify comment

* Modify comment

Co-authored-by: Renuka Manavalan <remanava@microsoft.com>
Co-authored-by: Renuka Manavalan <47282725+renukamanavalan@users.noreply.github.com>
Co-authored-by: Ubuntu <zain@zb-dev-vm.022x1jpnpm4u1iy2d325acts3c.yx.internal.cloudapp.net>
prgeor pushed a commit to prgeor/sonic-swss-common that referenced this pull request Feb 27, 2025
Pterosaur pushed a commit to Pterosaur/sonic-swss-common that referenced this pull request Apr 13, 2025
…ic-net#31)

Adding support for evaluating 'must' and 'when' expression based on customized xpath engine.
nazariig pushed a commit to nazariig/sonic-swss-common that referenced this pull request May 6, 2025
)

```<br>* 863a6a2 - (HEAD -> 202412) Merge branch '202411' of https://github.com/sonic-net/sonic-swss-common into 202412 (2025-02-15) [Sonic Automation]
* 8f47a37 - (origin/202411) Handle 'bulkget' in consumer_table_pops.lua (sonic-net#970) (2025-02-07) [mssonicbld]<br>```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants