Changeset 238361 in webkit


Ignore:
Timestamp:
Nov 18, 2018 4:50:21 AM (5 years ago)
Author:
yusukesuzuki@slowstart.org
Message:

Use Box<BinarySemaphore> instead of dispatch_semaphore_t
https://bugs.webkit.org/show_bug.cgi?id=189691

Reviewed by Ryosuke Niwa.

Use Box<BinarySemaphore> instead, which utilizes our WTF::Lock mechanism.

  • NetworkProcess/watchos/NetworkProximityManager.mm:

(WebKit::NetworkProximityManager::updateRecommendation):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r238360 r238361  
     12018-11-18  Yusuke Suzuki  <yusukesuzuki@slowstart.org>
     2
     3        Use Box<BinarySemaphore> instead of dispatch_semaphore_t
     4        https://bugs.webkit.org/show_bug.cgi?id=189691
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Use Box<BinarySemaphore> instead, which utilizes our WTF::Lock mechanism.
     9
     10        * NetworkProcess/watchos/NetworkProximityManager.mm:
     11        (WebKit::NetworkProximityManager::updateRecommendation):
     12
    1132018-11-17  Wenson Hsieh  <wenson_hsieh@apple.com>
    214
  • trunk/Source/WebKit/NetworkProcess/watchos/NetworkProximityManager.mm

    r234968 r238361  
    3636#import <pal/spi/cf/CFNetworkSPI.h>
    3737#import <wtf/BlockPtr.h>
     38#import <wtf/Box.h>
    3839#import <wtf/CompletionHandler.h>
    3940#import <wtf/cf/TypeCastsCF.h>
     41#import <wtf/threads/BinarySemaphore.h>
    4042
    4143WTF_DECLARE_CF_TYPE_TRAIT(SCNetworkInterface);
     
    299301    RELEASE_LOG(ProximityNetworking, "Requesting an immediate recommendation from iRATManager.");
    300302
    301     auto semaphore = adoptOSObject(dispatch_semaphore_create(0));
     303    auto semaphore = Box<BinarySemaphore>::create();
    302304    [m_iRATInterface getProximityLinkRecommendation:NO recommendation:[this, semaphore](NSArray<WRM_iRATProximityRecommendation *> *recommendations) {
    303305        processRecommendations(recommendations);
    304         dispatch_semaphore_signal(semaphore.get());
     306        semaphore->signal();
    305307    }];
    306 
    307     dispatch_semaphore_wait(semaphore.get(), dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC));
     308    semaphore->waitFor(1_s);
    308309}
    309310
Note: See TracChangeset for help on using the changeset viewer.