Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Swift Concurrency Talk 3

Swift Concurrency Talk 3

Swift Concurrency Talk 3

[email protected]

March 26, 2021
Tweet

Other Decks in Programming

Transcript

  1. શ߲໨ w$PODVSSFODZ3PBENBQ w"TZODBXBJU wSFBTZOD w4USVDUVSFE$PODVSSFODZ w5BTL"1* wBTZODMFU w$POUJOVBUJPOTGPSJOUFSGBDJOHBTZODUBTLTXJUITZODISPOPVTDPEF w5BTL-PDBM7BMVFT w"DUPS

    w(MPCBM"DUPS w"TZODISPOPVT)BOEMFST w4FOEBCMFBOE!4FOEBCMFDMPTVSFT w1SFWFOUJOH%BUB3BDFTJOUIF4XJGU$PODVSSFODZ.PEFM w$VTUPN&YFDVUPS w"TZOD4FRVFODFT w3FUISPXJOH$POGPSNBODFT w'PMMPXVQPO"TZOD4FRVFODFBOEQBSJUZXJUI4FRVFODFCBTFE"1*T w$MBSJGZFOEPGJUFSBUJPOCFIBWJPSGPS"TZOD4FRVFODF w&GGFDUGVM3FBEPOMZ1SPQFSUJFT w$PODVSSFODZ*OUFSPQFSBCJMJUZXJUI0CKFDUJWF$
  2. ͳͥඞཁ ΑΓৄࡉʹίϯτϩʔϧ͕ඞཁͳ৔໘ wΑΓίʔυͷಈ࡞ΛΤϯδχΞ͕໌ࣔతʹࢦఆ͢Δ͜ͱͰ ύϑΥʔϚϯεͷ޲্͢Δ ͔΋͠Εͳ͍ ৔߹ 
 
 ҰͭͷBDUPS͕ଞͷBDUPSʹϦΫΤετΛසൟʹߦ͍ͬͯΔ͕ɺͦͷ BDUPS͕$PODVSSFOUʹಈ࡞ͯ͠΋͋·ΓϝϦοτ͕ͳ͍৔߹͸ಉ͡

    FYFDVUPSͷதͰ࣮ߦͨ͠ํ͕FYFDVUPSΛεΠον͢ΔΑ͏΋ SVOUJNFίετ͕ݮΔ͔΋͠Εͳ͍ 
 
 ͋ΔBTZODؔ਺͕ಉ͡BDPUS΁ͷݺͼग़͠ΛTVTQFOEͳ͠ʹߦͬͯ ͍Δ৔߹ɺ໌ࣔతʹFYFDVUPSΛࢦఆͯ͠FYFDVUPSؒͷεΠονΛ ݮΒ͢͜ͱ͕Ͱ͖Δ
  3. 'PSNBMUSFBUNFOUPGDPODVSSFODZ w 4XJGUͰ͸$ݴޠͱಉ༷ʹIBQQFOTCFGPSFͰ಺෦ͷ5ISFBEͷॱ ൪Λ͋Δఔ౓ܾΊ͍ͯΔɻ w 4XJGUͰ͸શͯͷϝϞϦʹӨڹ͢Δૢ࡞͸ܾ·ͬͨΞΫηεظؒʹ ඥ͍͓ͮͯΓɺݱࡏͷ5ISFBEͰ࣮ߦ͞Ε͍ͯΔଞͷΠϕϯτͱ׬ શʹ௚ྻʹͳΔɻ ಉ࣌ʹى͖Δ͜ͱ͕ͳ͍ 

    w ϝϞϦ΁ͷΞΫηεʹऴΘΓ͕͋ΔɺΠϕϯτΑΓ΋લʹൃੜͨ͠ ৔߹ɺͦͷϝϞϦ΁ͷ࡞༻΋ͦͷΠϕϯτͷલʹൃੜ͢Δ w ٯʹϝϞϦ΁ͷΞΫηεͷ։͕࢝͋ΔΠϕϯτΑΓ΋ޙʹൃੜͨ͠ ৔߹ɺͦͷϝϞϦ΁ͷ࡞༻΋ͦͷΠϕϯτͷޙʹൃੜ͢Δ
  4. &YFDVUPSTBOEKPCT w શͯͷFYFDVUPS͸͜ͷϓϩτίϧʹద߹͠ͳ͚Ε͹ͳΒͳ͍ w ϝιουͷݺͼग़͠ʹґଘؔ܎͕͋Δ 
 KPCFYFDVUF DVSSFOU&YFDVUPS ͸FORVFVF @

    ͷޙʹݺ͹ͳ͚Ε͹ ͳΒͳ͍ 
 TFSJBMFYFDVUPSͷ৔߹ɺશͯͷKPC͸ॱ൪ʹ࣮ߦ͞ΕΔΑ͏ʹ͠ͳ͚Ε ͹ͳΒͳ͍ɻKPC"ͷશͯͷΠϕϯτ͸KPC#ΑΓ΋લʹൃੜ͠ͳ͚Ε͹ͳ Βͳ͍ɻ
  5. EFGBVMUTFSJBMFYFDVUPS w DVTUPNFYFDVUPSΛએݴ͍ͯ͠ͳ͍BDUPSݸʑʹΠϯελϯεԽ ͞ΕΔ w ඇಉظϩοΫϕʔεͰઃܭ͞Ε͍ͯΔɻඞͣTVTQFOE SFTVNF͢ Δ TXJUDIJOH ͷͰ͸ͳ͘ɺՄೳͳΒ͹طଘͷ5ISFBE͕BDUPSʹ

    ୅Θͬͯଈ࣌ʹ࣮ߦΛ։࢝͢Δ w ҎԼͷঢ়گͰ͸TXJUDIJOH͸ෆՄೳ 
 BDUPS͕͋Δ5ISFBEͰطʹ࣮ߦத 
 BDUPSΛॲཧ͢ΔKPC͕EFGBVMUDPODVSSFOUFYFDVUPS্ʹε έδϡʔϧ͞Ε͍ͯΔ
  6. "DUPSFYFDVUPST w TFSJBM&YFDVUPSΛએݴ͢Δ͜ͱ͕Ͱ͖Δ 
 BDUPSJTPMBUFEͰ͋ͬͯ͸ͳΒͳ͍ w EFMFHBUF"DUPSΛએݴ͢Δ͜ͱ͕Ͱ͖Δɻ 
 BDUPSJTPMBUFEͰ͋ͬͯ͸ͳΒͳ͍ 


    "DUPSQSPUPDPMʹ$POWFSUJCMFͰͳ͚Ε͹ͳΒͳ͍ 
 ৗʹಉ͡BDUPSΠϯελϯεΛฦ͞ͳ͚Ε͹ͳΒͳ͍ 
 EFMFHBUF"DUPSͷϝϯόʔΛར༻͢Δ͜ͱ͸Մೳ 
 TFSJBM&YFDVUPS͸EFMFHBUF"DUPSͱಉظ͕औΒΕΔ ͦͷ৔߹ TFSJBM&YFDVUPS͸!JOMJOBCMFʹͳΔ༧ఆ
  7. ͳͥඞཁ w DPNQVUFEQSPQFSUZͰඇಉظॲཧ͔Β໭Γ஋ΛಘΔʹ͸ϒϩοΫ͕ඞཁ w GVODUJPOΛ࢖ͬͯXPSLBSPVOEΛ࡞੒Ͱ͖Δ͕ɺޡͬͯHFUUFSΛ࢖ͬͯϒϩ οΫΛҾ͖ى͜͢Մೳੑ΋͋Δ Ҿ਺ TFMGҎ֎ Λ౉ͤͳ͍ DPNQMFUJPOIBOEMFSΛ౉ͤͳ͍

    BTZODΛઃఆ͢Δ͜ͱ͕Ͱ͖Ε͹ɺݺͼग़͠ଆʹ΋େ͖͍DPNQVUBUJPO͕͋Δ͜ ͱΛܕνΣοΫ͔Β఻͑Δ͜ͱ͕Ͱ͖Δ "1*EFTJHOHVJEMJOFʹ΋Ϛον͢Δ IUUQTTXJGUPSHEPDVNFOUBUJPOBQJEFTJHOHVJEFMJOFTHFOFSBMDPOWFOUJPOT
  8. ؾʹͳΔ͜ͱ wTUSVDUVSFEDPODVSSFODZͷ3FWJFX͍ͭऴΘΔʁ BTZODMFU ΍5BTL-PDBM͸͜Ε଴ͪ  w"DUPS͸·ͩ·ͩมΘΓͦ͏ͳ༧ײ (MPCBMBDUPS  OPOJTPMBUFEͳͲ 

    w݁ہϦϦʔεํ๏΍࣌ظͷ࿩͸Ͳ͏ͳͬͨʁ w$PNCJOF΍4XJGU/*0ͳͲͷରԠ࣌ظ͸ʁ wUZQFFSSPSͳͲଞͷػೳͱͷؔΘΓ͸ʁ wNPWBCMFUZQF͕ೖΔͱͲ͏ͳΔʁ