iOS多線程(3)-GCD

  • 簡介:

    為什么要用 GCD 呢准颓?因?yàn)?GCD 有很多好處啊霍转,具體如下:
    GCD 可用于多核的并行運(yùn)算
    GCD 會自動(dòng)利用更多的 CPU 內(nèi)核(比如雙核、四核)
    GCD 會自動(dòng)管理線程的生命周期(創(chuàng)建線程、調(diào)度任務(wù)、銷毀線程)
    程序員只需要告訴 GCD 想要執(zhí)行什么任務(wù)欢搜,不需要編寫任何線程管理代碼
    既然 GCD 有這么多的好處,那么下面我們就來系統(tǒng)的學(xué)習(xí)一下 GCD 的使用方法谴轮。

目錄:

  • 隊(duì)列創(chuàng)建

  • 同步異步

  • 線程間通訊

  • 延遲執(zhí)行(dispatch_after)

  • 定時(shí)器(dispatch_timer)

  • 一次執(zhí)行(dispatch_once)

  • 迭代(dispatch_apply)

  • 隊(duì)列組(dispatch_group_notify)

  • 等待(dispatch_group_wait)

  • 信號(dispatch_semaphore_t)

  • 并發(fā)控制通過信號實(shí)現(xiàn)

  • 隊(duì)列創(chuàng)建:
    //串行隊(duì)列
    dispatch_queue_t queue = dispatch_queue_create("com.gcd.peace", DISPATCH_QUEUE_SERIAL);
    //并行隊(duì)列
    dispatch_queue_t queue = dispatch_queue_create("com.gcd.peace", DISPATCH_QUEUE_CONCURRENT);
    //全局并行隊(duì)列
    dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    //主線程隊(duì)列
    dispatch_queue_t queue = dispatch_get_main_queue();
    
  • 同步異步:
    - (void)asyncAction {
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      dispatch_async(queue, ^{
          NSLog(@"async---%@",[NSThread currentThread]);
      });
    }
    
    - (void)syncAction {
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      dispatch_sync(queue, ^{
          NSLog(@"sync---%@",[NSThread currentThread]);
      });
    }
    
    輸出:
    ---<NSThread: 0x60c00026bd40>{number = 5, name = (null)}
    ---<NSThread: 0x60000007f300>{number = 1, name = main}
    
  • 線程間通訊:
    - (void)asyncToSyncAction {
      dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
          NSLog(@"---%@",[NSThread currentThread]);
          
          // 回到主線程
          dispatch_async(dispatch_get_main_queue(), ^{
              NSLog(@"---%@",[NSThread currentThread]);
          });
      });
    }
    
    輸出:
    ---<NSThread: 0x60c00026bd40>{number = 5, name = (null)}
    ---<NSThread: 0x60000007f300>{number = 1, name = main}
    
  • 柵欄(dispatch_barrier_async):
    - (void)barrierAction {
        dispatch_queue_t queue = dispatch_queue_create("com.gcd.peace", DISPATCH_QUEUE_CONCURRENT);
      
        for (int i = 0; i < 10; i ++) {
            dispatch_async(queue, ^{
                [NSThread sleepForTimeInterval:2];
                NSLog(@"1---%@",[NSThread currentThread]);
            });
        }
      
        //barrier
        dispatch_barrier_async(queue, ^{
            [NSThread sleepForTimeInterval:2];
            NSLog(@"[Barrier: ---%@",[NSThread currentThread]);
        });
    
        for (int i = 0; i < 10; i ++) {
            dispatch_async(queue, ^{
                [NSThread sleepForTimeInterval:2];
                NSLog(@"3---%@",[NSThread currentThread]);
            });
        }
    }
    
    輸出:
    2018-03-20 17:57:39.417137+0800 GCD[55856:2568834] 1---<NSThread: 0x604000074780>{number = 6, name = (null)}
    2018-03-20 17:57:39.417137+0800 GCD[55856:2568833] 1---<NSThread:   0x6000002701c0>{number = 3, name = (null)}
    2018-03-20 17:57:39.417138+0800 GCD[55856:2568832] 1---<NSThread: 0x60c00007e7c0>{number = 4, name = (null)}
    2018-03-20 17:57:39.417148+0800 GCD[55856:2568835] 1---<NSThread: 0x60800007d7c0>{number = 5, name = (null)}
    2018-03-20 17:57:39.417197+0800 GCD[55856:2568853] 1---<NSThread: 0x600000270080>{number = 7, name = (null)}
    2018-03-20 17:57:39.417247+0800 GCD[55856:2568855] 1---<NSThread: 0x6040000754c0>{number = 8, name = (null)}
    2018-03-20 17:57:39.417308+0800 GCD[55856:2568856] 1---<NSThread: 0x60000026fac0>{number = 10, name = (null)}
    2018-03-20 17:57:39.417329+0800 GCD[55856:2568854] 1---<NSThread: 0x604000074a80>{number = 9, name = (null)}
    2018-03-20 17:57:39.417344+0800 GCD[55856:2568857] 1---<NSThread: 0x604000074380>{number = 11, name = (null)}
    2018-03-20 17:57:39.417361+0800 GCD[55856:2568858] 1---<NSThread: 0x60c00007e800>{number = 12, name = (null)}
    2018-03-20 17:57:41.420468+0800 GCD[55856:2568858] [Barrier: ---<NSThread: 0x60c00007e800>{number = 12, name = (null)}
    2018-03-20 17:57:43.423862+0800 GCD[55856:2568858] 3---<NSThread: 0x60c00007e800>{number = 12, name = (null)}
    2018-03-20 17:57:43.423827+0800 GCD[55856:2568855] 3---<NSThread: 0x6040000754c0>{number = 8, name = (null)}
    2018-03-20 17:57:43.423826+0800 GCD[55856:2568854] 3---<NSThread: 0x604000074a80>{number = 9, name = (null)}
    2018-03-20 17:57:43.423827+0800 GCD[55856:2568857] 3---<NSThread: 0x604000074380>{number = 11, name = (null)}
    2018-03-20 17:57:43.423855+0800 GCD[55856:2568853] 3---<NSThread: 0x600000270080>{number = 7, name = (null)}
    2018-03-20 17:57:43.423823+0800 GCD[55856:2568856] 3---<NSThread: 0x60000026fac0>{number = 10, name = (null)}
    2018-03-20 17:57:43.423949+0800 GCD[55856:2568834] 3---<NSThread: 0x604000074780>{number = 6, name = (null)}
    2018-03-20 17:57:43.423952+0800 GCD[55856:2568833] 3---<NSThread: 0x6000002701c0>{number = 3, name = (null)}
    2018-03-20 17:57:43.423960+0800 GCD[55856:2568835] 3---<NSThread: 0x60800007d7c0>{number = 5, name = (null)}
    2018-03-20 17:57:43.423964+0800 GCD[55856:2568832] 3---<NSThread: 0x60c00007e7c0>{number = 4, name = (null)}
    
  • 延遲執(zhí)行(dispatch_after):
    - (void)afterAction {
      NSLog(@"[After]: begin currentThread---%@",[NSThread currentThread]);
      
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
          NSLog(@"[After]: main ---%@",[NSThread currentThread]);
      });
      
      dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
          NSLog(@"[After]: global ---%@",[NSThread currentThread]);
      });
    }
    
    輸出:
    2018-03-20 18:01:33.749444+0800 GCD[55856:2568766] [After]: begin currentThread---<NSThread: 0x60000006e280>{number = 1, name = main}
    2018-03-20 18:01:35.928257+0800 GCD[55856:2568766] [After]: main ---<NSThread: 0x60000006e280>{number = 1, name = main}
    2018-03-20 18:01:35.928274+0800 GCD[55856:2571380] [After]: global ---<NSThread: 0x60c00007e280>{number = 13, name = (null)}
    
  • 定時(shí)器(dispatch_timer):
    @property(nonatomic,strong) dispatch_source_t tTimer;
    
    - (void)timerAction {
     NSLog(@"[Timer]: begin currentThread---%@",[NSThread currentThread]);
     
     if (!self.tTimer) {
         self.tTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
         NSLog(@"self.tTimer = %@",self.tTimer);
         dispatch_source_set_timer(self.tTimer,
                                   dispatch_walltime(NULL, 0 * NSEC_PER_SEC),
                                   0.32 * NSEC_PER_SEC,
                                   0);
         dispatch_source_set_event_handler(self.tTimer, ^{
             NSLog(@"1111");
         });
     
         dispatch_resume(self.tTimer);
     }
     else {
         dispatch_source_cancel(self.tTimer);
         self.tTimer = nil;
     }
     //        dispatch_suspend(self.tTimer);
     //        dispatch_source_cancel(self.tTimer);
     //        self.tTimer = nil; Crash
     
     //        dispatch_suspend(self.tTimer);
     //        self.tTimer = nil; Crash
    }
    
  • 一次執(zhí)行(dispatch_once):
    - (void)onceAction {
      __block int index = 0;
      for (int i = 0; i < 10; i ++) {
          static dispatch_once_t onceToken;
          dispatch_once(&onceToken, ^{
              index ++;
              NSLog(@"[Once]:-------index = %d",index);
          });
      }
    }
    
    輸出:
    2018-03-20 18:03:17.189632+0800 GCD[55856:2568766] [Once]:-------index = 1
    
  • 迭代(dispatch_apply):
    - (void)applyAction {
      //并行迭代
      dispatch_queue_t queue = dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      //串行隊(duì)列迭代與for循環(huán)效果一樣
      //queue = dispatch_queue_t queue = dispatch_queue_create("com.gcd.peace", DISPATCH_QUEUE_SERIAL);
      
      NSLog(@"apply---begin");
      dispatch_apply(6, queue, ^(size_t index) {
          NSLog(@"%zd---%@",index, [NSThread currentThread]);
          [NSThread sleepForTimeInterval:2];
      });
      NSLog(@"apply---end");
    }
    
    并行隊(duì)列輸出:
    2018-03-20 18:05:42.458703+0800 GCD[56041:2574450] apply---begin
    2018-03-20 18:05:42.459384+0800 GCD[56041:2574450] 0---<NSThread: 0x60c000262bc0>{number = 1, name = main}
    2018-03-20 18:05:42.459417+0800 GCD[56041:2574512] 1---<NSThread: 0x60c00027f840>{number = 3, name = (null)}
    2018-03-20 18:05:42.459504+0800 GCD[56041:2574499] 4---<NSThread: 0x6080002786c0>{number = 7, name = (null)}
    2018-03-20 18:05:42.459504+0800 GCD[56041:2574502] 3---<NSThread: 0x604000270e00>{number = 4, name = (null)}
    2018-03-20 18:05:42.459506+0800 GCD[56041:2574500] 5---<NSThread: 0x604000270c00>{number = 6, name = (null)}
    2018-03-20 18:05:42.459521+0800 GCD[56041:2574501] 2---<NSThread: 0x608000278a00>{number = 5, name = (null)}
    2018-03-20 18:05:44.463743+0800 GCD[56041:2574450] apply---end
    
    串行隊(duì)列輸出:
    2018-03-20 18:07:33.988048+0800 GCD[56083:2576141] apply---begin
    2018-03-20 18:07:33.988516+0800 GCD[56083:2576141] 0---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:35.989109+0800 GCD[56083:2576141] 1---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:37.990556+0800 GCD[56083:2576141] 2---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:39.992050+0800 GCD[56083:2576141] 3---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:41.993583+0800 GCD[56083:2576141] 4---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:43.995163+0800 GCD[56083:2576141] 5---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:07:45.995811+0800 GCD[56083:2576141] apply---end
    
  • 隊(duì)列組(dispatch_group_notify):
    - (void)groupNotifyAction {
      NSLog(@"group---begin");
      
      dispatch_group_t group = dispatch_group_create();
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      
      dispatch_group_async(group, queue, ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"1---%@",[NSThread currentThread]);
      });
      
      dispatch_group_async(group, queue, ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"2---%@",[NSThread currentThread]);
      });
      
      dispatch_group_notify(group, [self mainQueue], ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"3---%@",[NSThread currentThread]);
          NSLog(@"group notify");
      });
    }
    
    輸出:
    2018-03-20 18:09:47.306064+0800 GCD[56083:2576141] group---begin
    2018-03-20 18:09:49.307609+0800 GCD[56083:2576199] 2---<NSThread: 0x60800006ce00>{number = 4, name = (null)}
    2018-03-20 18:09:49.307608+0800 GCD[56083:2577770] 1---<NSThread: 0x60400007fac0>{number = 3, name = (null)}
    2018-03-20 18:09:51.309380+0800 GCD[56083:2576141] 3---<NSThread: 0x60c000065740>{number = 1, name = main}
    2018-03-20 18:09:51.309744+0800 GCD[56083:2576141] group notify
    
    - (void)groupNotify1Action {
      NSLog(@"group---begin");
      
      dispatch_group_t group = dispatch_group_create();
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      
      dispatch_group_enter(group);
      dispatch_async(queue, ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"1---%@",[NSThread currentThread]);
          dispatch_group_leave(group);
      });
      
      dispatch_group_enter(group);
      dispatch_async(queue, ^{
          [NSThread sleepForTimeInterval:5];
          NSLog(@"2---%@",[NSThread currentThread]);
          dispatch_group_leave(group);
      });
      
      dispatch_group_notify(group, [self mainQueue], ^{
          NSLog(@"group notify : %@",[NSThread currentThread]);
      });
    }
    
    輸出:
    2018-03-20 18:09:53.329762+0800 GCD[56083:2576141] group---begin
    2018-03-20 18:09:55.332737+0800 GCD[56083:2576199] 1---<NSThread: 0x60800006ce00>{number = 4, name = (null)}
    2018-03-20 18:09:58.331259+0800 GCD[56083:2577770] 2---<NSThread: 0x60400007fac0>{number = 3, name = (null)}
    2018-03-20 18:09:58.331676+0800 GCD[56083:2576141] group notify : <NSThread: 0x60c000065740>{number = 1, name = main}
    
  • 等待(dispatch_group_wait):
    - (void)groupWaitAction {
      NSLog(@"group---begin");
      
      dispatch_group_t group =  dispatch_group_create();
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      
      dispatch_group_async(group, queue, ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"1---%@",[NSThread currentThread]);
      });
      
      dispatch_group_async(group, queue, ^{
          [NSThread sleepForTimeInterval:5];
          NSLog(@"2---%@",[NSThread currentThread]);
      });
      
      dispatch_group_wait(group, DISPATCH_TIME_FOREVER);
      
      NSLog(@"group---end");
    }
    
    輸出:
    2018-03-20 18:12:57.523759+0800 GCD[56083:2576141] group---begin
    2018-03-20 18:12:59.527048+0800 GCD[56083:2579780] 1---<NSThread: 0x600000260780>{number = 5, name = (null)}
    2018-03-20 18:13:02.524335+0800 GCD[56083:2577781] 2---<NSThread: 0x60000007fd40>{number = 6, name = (null)}
    2018-03-20 18:13:02.524954+0800 GCD[56083:2576141] group---end
    
  • 信號(dispatch_semaphore_t):
    //通過信號實(shí)現(xiàn)同步功能
    - (void)semaphoreAction {
      NSLog(@"semaphore---begin");
      
      dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
      dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);
      
      dispatch_async(queue, ^{
          [NSThread sleepForTimeInterval:2];
          NSLog(@"semaphore --- %@",[NSThread currentThread]);
          
          dispatch_semaphore_signal(semaphore);
      });
      
      dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);//信號量=0則阻擋,>0則通過
      NSLog(@"semaphore---end");
    }
    
    輸出:
    2018-03-20 18:14:28.265856+0800 GCD[56083:2576141] semaphore---begin
    2018-03-20 18:14:30.271145+0800 GCD[56083:2580996] semaphore --- <NSThread: 0x60c000078880>{number = 8, name = (null)}
    2018-03-20 18:14:30.271384+0800 GCD[56083:2576141] semaphore---end
    
    //通過信號實(shí)現(xiàn)鎖
    - (void)semaphore1Action {
      dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
      dispatch_semaphore_t semaphore = dispatch_semaphore_create(1);
      
      for (int i = 0; i < 100; i++) {
          dispatch_async(queue, ^{
              // 相當(dāng)于加鎖
              dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);
              NSLog(@"i = %zd semaphore = %@", i, semaphore);
              // 相當(dāng)于解鎖
              dispatch_semaphore_signal(semaphore);
          });
      }
    }
    
    輸出:
    2018-03-20 18:16:21.561341+0800 GCD[56217:2582806] i = 0 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.561717+0800 GCD[56217:2582805] i = 1 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.561999+0800 GCD[56217:2582803] i = 2 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.562277+0800 GCD[56217:2582804] i = 3 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.562508+0800 GCD[56217:2582812] i = 4 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.562745+0800 GCD[56217:2582823] i = 5 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.562979+0800 GCD[56217:2582824] i = 6 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.563213+0800 GCD[56217:2582825] i = 7 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.563442+0800 GCD[56217:2582826] i = 8 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    2018-03-20 18:16:21.563671+0800 GCD[56217:2582827] i = 9 semaphore = <OS_dispatch_semaphore: 0x60c000084510>
    
  • 并發(fā)控制通過信號實(shí)現(xiàn):
    void dispatch_async_limit(dispatch_queue_t queue,NSUInteger limitSemaphoreCount, dispatch_block_t block) {
      //控制并發(fā)數(shù)的信號量
      static dispatch_semaphore_t limitSemaphore;
      
      //專門控制并發(fā)等待的線程
      static dispatch_queue_t receiverQueue;
      
      //使用 dispatch_once而非 lazy 模式吹埠,防止可能的多線程搶占問題
      static dispatch_once_t onceToken;
      dispatch_once(&onceToken, ^{
          limitSemaphore = dispatch_semaphore_create(limitSemaphoreCount);
          receiverQueue = dispatch_queue_create("receiver", DISPATCH_QUEUE_SERIAL);
      });
      
      // 如不加 receiverQueue 放在主線程會阻塞主線程
      dispatch_async(receiverQueue, ^{
          //可用信號量后才能繼續(xù)第步,否則等待
          dispatch_semaphore_wait(limitSemaphore, DISPATCH_TIME_FOREVER);
          dispatch_async(queue, ^{
              !block ? : block();
              //在該工作線程執(zhí)行完成后釋放信號量
              long semaphore = dispatch_semaphore_signal(limitSemaphore);
              if (semaphore > 0) {
                  NSLog(@"\n");
              }
          });
      });
    }
    
    - (void)limitAction {
      for (int i = 0; i < 10; i++) {
          dispatch_async_limit([self serialQueue],3, ^{
              sleep(2);
              NSLog(@"------i = %d",i);
          });
      }
    }
    
    輸出:
    2018-03-20 17:33:45.367914+0800 GCD[55534:2553299] ------i = 1
    2018-03-20 17:33:45.367914+0800 GCD[55534:2553303] ------i = 0
    2018-03-20 17:33:45.367916+0800 GCD[55534:2553300] ------i = 2
    2018-03-20 17:33:45.368276+0800 GCD[55534:2553303] 
    2018-03-20 17:33:47.373465+0800 GCD[55534:2553300] ------i = 3
    2018-03-20 17:33:47.373482+0800 GCD[55534:2553299] ------i = 4
    2018-03-20 17:33:47.373496+0800 GCD[55534:2553302] ------i = 5
    2018-03-20 17:33:47.373856+0800 GCD[55534:2553300] 
    2018-03-20 17:33:49.379032+0800 GCD[55534:2553302] ------i = 6
    2018-03-20 17:33:49.379048+0800 GCD[55534:2553299] ------i = 7
    2018-03-20 17:33:49.379048+0800 GCD[55534:2553303] ------i = 8
    2018-03-20 17:33:49.379452+0800 GCD[55534:2553299] 
    2018-03-20 17:33:51.383480+0800 GCD[55534:2553301] ------i = 9
    
  • 源碼:

    代碼在這里

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末疮装,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子粘都,更是在濱河造成了極大的恐慌廓推,老刑警劉巖,帶你破解...
    沈念sama閱讀 216,372評論 6 498
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件翩隧,死亡現(xiàn)場離奇詭異樊展,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)堆生,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,368評論 3 392
  • 文/潘曉璐 我一進(jìn)店門专缠,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人淑仆,你說我怎么就攤上這事涝婉。” “怎么了蔗怠?”我有些...
    開封第一講書人閱讀 162,415評論 0 353
  • 文/不壞的土叔 我叫張陵墩弯,是天一觀的道長。 經(jīng)常有香客問我寞射,道長渔工,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,157評論 1 292
  • 正文 為了忘掉前任桥温,我火速辦了婚禮引矩,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘策治。我一直安慰自己脓魏,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,171評論 6 388
  • 文/花漫 我一把揭開白布通惫。 她就那樣靜靜地躺著能犯,像睡著了一般。 火紅的嫁衣襯著肌膚如雪百新。 梳的紋絲不亂的頭發(fā)上檬贰,一...
    開封第一講書人閱讀 51,125評論 1 297
  • 那天,我揣著相機(jī)與錄音遵湖,去河邊找鬼悔政。 笑死,一個(gè)胖子當(dāng)著我的面吹牛延旧,可吹牛的內(nèi)容都是我干的谋国。 我是一名探鬼主播,決...
    沈念sama閱讀 40,028評論 3 417
  • 文/蒼蘭香墨 我猛地睜開眼迁沫,長吁一口氣:“原來是場噩夢啊……” “哼芦瘾!你這毒婦竟也來了捌蚊?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,887評論 0 274
  • 序言:老撾萬榮一對情侶失蹤近弟,失蹤者是張志新(化名)和其女友劉穎缅糟,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體祷愉,經(jīng)...
    沈念sama閱讀 45,310評論 1 310
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡窗宦,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,533評論 2 332
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了二鳄。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片赴涵。...
    茶點(diǎn)故事閱讀 39,690評論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖泥从,靈堂內(nèi)的尸體忽然破棺而出句占,到底是詐尸還是另有隱情,我是刑警寧澤躯嫉,帶...
    沈念sama閱讀 35,411評論 5 343
  • 正文 年R本政府宣布纱烘,位于F島的核電站,受9級特大地震影響祈餐,放射性物質(zhì)發(fā)生泄漏擂啥。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,004評論 3 325
  • 文/蒙蒙 一帆阳、第九天 我趴在偏房一處隱蔽的房頂上張望哺壶。 院中可真熱鬧,春花似錦蜒谤、人聲如沸山宾。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,659評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽资锰。三九已至,卻和暖如春阶祭,著一層夾襖步出監(jiān)牢的瞬間绷杜,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,812評論 1 268
  • 我被黑心中介騙來泰國打工濒募, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留鞭盟,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 47,693評論 2 368
  • 正文 我出身青樓瑰剃,卻偏偏與公主長得像齿诉,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,577評論 2 353

推薦閱讀更多精彩內(nèi)容

  • 本文首發(fā)于我的個(gè)人博客:「程序員充電站」[https://itcharge.cn]文章鏈接:「傳送門」[https...
    ITCharge閱讀 347,828評論 308 1,926
  • 一鹃两、前言 上一篇文章iOS多線程淺匯-原理篇中整理了一些有關(guān)多線程的基本概念遗座。本篇博文介紹的是iOS中常用的幾個(gè)多...
    nuclear閱讀 2,050評論 6 18
  • 1. GCD簡介 什么是GCD呢舀凛?我們先來看看百度百科的解釋簡單了解下概念 引自百度百科:Grand Centra...
    千尋_544f閱讀 362評論 0 0
  • 看到過不少文章描繪出同窗好友多年后重聚的場景猛遍,總是淚眼婆娑馋记,感嘆良多,心存戚戚懊烤,我以為這次見到Y(jié)后也會如此梯醒。 Y是...
    頌世梵歌閱讀 436評論 0 2
  • 1.帶實(shí)習(xí)生上課,聲音太小腌紧,講太多茸习,學(xué)生不太買賬。 接下來壁肋,還是自己來上課吧号胚。進(jìn)度不能落后。 2.實(shí)習(xí)生買了水果浸遗,...
    Alian__閱讀 212評論 0 0