Skip to content

Remove Semaphore deprecated APIs #12609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2020

Conversation

rajkan01
Copy link
Contributor

@rajkan01 rajkan01 commented Mar 10, 2020

Summary of changes

Removed Semaphore deprecated APIs.

Impact of changes

Breaking change: Semaphore wait and wait_until methods have been deprecated since Mbed OS 5.13 and are removed now.

Migration actions required

Use Semaphore acquire, try_acquire, try_acquire_for and try_acquire_until methods.

Documentation

None


Pull request type

[] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[x] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Reviewers

@evedon


@ciarmcom ciarmcom requested review from evedon and a team March 10, 2020 14:00
@ciarmcom
Copy link
Member

@rajkan01, thank you for your changes.
@evedon @ARMmbed/mbed-os-pan @ARMmbed/mbed-os-test @ARMmbed/mbed-os-core @ARMmbed/mbed-os-maintainers please review.

@@ -201,8 +201,8 @@ void test_no_wait(void)
Semaphore sem(0, 1);
T timeout;
timeout.attach_callback(mbed::callback(sem_callback, &sem), 0ULL);
int32_t sem_slots = sem.wait(0);
TEST_ASSERT_EQUAL(1, sem_slots);
bool sem_sts = sem.try_acquire_for(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
bool sem_sts = sem.try_acquire_for(0);
bool sem_acquired = sem.try_acquire_for(0);
TEST_ASSERT_EQUAL(true, sem_acquired);

I suggest using a more meaningful variable name.

Copy link
Contributor

Choose a reason for hiding this comment

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

Idiomatically, it's better to use try_acquire() rather than try_acquire_for(0).

Doesn't matter much if mixing it with timed stuff, but in principle, try_acquire() gives you scope to omit timing code from bare metal builds, whereas the _for form forcibly includes it.

@rajkan01 rajkan01 force-pushed the semwait_remove_deprecation branch from 4646c05 to 06cfc1a Compare March 10, 2020 15:01
kjbracey
kjbracey previously approved these changes Mar 10, 2020
@mergify mergify bot added needs: CI and removed needs: review labels Mar 10, 2020
evedon
evedon previously approved these changes Mar 10, 2020
@adbridge
Copy link
Contributor

CI started

@mergify mergify bot added needs: work and removed needs: CI labels Mar 11, 2020
@mbed-ci
Copy link

mbed-ci commented Mar 11, 2020

Test run: FAILED

Summary: 3 of 4 test jobs failed
Build number : 1
Build artifacts

Failed test jobs:

  • jenkins-ci/mbed-os-ci_build-ARM
  • jenkins-ci/mbed-os-ci_build-IAR
  • jenkins-ci/mbed-os-ci_build-GCC_ARM

@rajkan01
Copy link
Contributor Author

there are two libraries are using deprecated Semaphore wait API that needs to be rebuilt for this PR:

targets/TARGET_WICED/TOOLCHAIN_ARMC6/TARGET_MTB_MXCHIP_EMW3166/libwiced_drivers.ar - @michalpasztamobica @AnttiKauppila

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar
@ARMmbed/team-ublox

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 16, 2020

@rajkan01 I remember seeing this commit somewhere else, in another PR, where was it? Did we receive any response there from teams?

0xc0170
0xc0170 previously approved these changes Mar 16, 2020
@rajkan01 rajkan01 force-pushed the semwait_remove_deprecation branch from 06cfc1a to a6b78c6 Compare March 16, 2020 16:37
@mergify mergify bot dismissed stale reviews from kjbracey, evedon, and 0xc0170 March 16, 2020 16:38

Pull request has been modified.

@evedon
Copy link
Contributor

evedon commented Mar 17, 2020

@rajkan01 I remember seeing this commit somewhere else, in another PR, where was it? Did we receive any response there from teams?

The other PR is #12572 (comment)
So we might need the libary update in a separate PR.

@tymoteuszblochmobica
Copy link
Contributor

Commit updated with cherry-pick #12609
tymoteuszblochmobica@7e146b0

@rajkan01
Copy link
Contributor Author

Commit updated with cherry-pick #12609
tymoteuszblochmobica/mbed-os@7e146b0

@tymoteuszblochmobica As discussed, please raise a separate PR as Your changes are not dependent on this PR.

@adbridge
Copy link
Contributor

@0xc0170 @evedon @kjbracey-arm please re-review to confirm happy with updates

@adbridge
Copy link
Contributor

CI restarted while awaiting review approvals

@mbed-ci
Copy link

mbed-ci commented Mar 27, 2020

Test run: SUCCESS

Summary: 6 of 6 test jobs passed
Build number : 2
Build artifacts

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 30, 2020

The job passed, the failures are not related to this test job (misconfig in CI).

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 31, 2020

I'll fix the statuses and merge this one

@0xc0170 0xc0170 merged commit 8b92972 into ARMmbed:master Mar 31, 2020
@mergify mergify bot removed the ready for merge label Mar 31, 2020
@0xc0170
Copy link
Contributor

0xc0170 commented Mar 31, 2020

targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/TARGET_MODULE_UBLOX_ODIN_W2/sdk/TOOLCHAIN_ARM/libublox-odin-w2-driver.ar

@rajkan01 Where is this one being tracked? I was just notified that ublox won't build on master today.

@0xc0170
Copy link
Contributor

0xc0170 commented Mar 31, 2020

cc @ARMmbed/team-ublox @MarceloSalazar

@aqib-ublox
Copy link
Contributor

@0xc0170 our PR almost ready we would try tomorrow just some out of box testing remaing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants