1 00:00:05,890 --> 00:00:11,110 Two very important traits we need to talk about are sink and sin. 2 00:00:11,560 --> 00:00:17,640 Types that implement sin are safe to pass by value to another thread. 3 00:00:17,650 --> 00:00:25,450 And when I say safe, I mean that they are free from data races and other undefined behavior types that 4 00:00:25,450 --> 00:00:29,290 implements and can also be moved across threads. 5 00:00:30,090 --> 00:00:38,250 Now types that implement sink are safe to pass by non mutable reference to another thread. 6 00:00:39,090 --> 00:00:48,690 These types can be shared across threads so Syn can be moved across threads and sync can be shared across 7 00:00:48,690 --> 00:00:49,380 threads. 8 00:00:50,100 --> 00:00:58,110 Almost every rust type is cind, but there are some exceptions such as our RC reference counter smart 9 00:00:58,110 --> 00:00:58,770 pointer. 10 00:00:58,770 --> 00:01:01,380 So let's take a look at that real quick. 11 00:01:01,470 --> 00:01:09,870 So we'll say let RC one equals a new RC, so a new reference counter smart pointer and we'll say string 12 00:01:10,080 --> 00:01:18,660 from and then we'll just do tests to keep it simple and then we'll say led RC two equals RC one dot 13 00:01:18,750 --> 00:01:22,380 clone and now we'll spawn a thread. 14 00:01:23,120 --> 00:01:25,970 And we'll just try to use RC to in here. 15 00:01:26,270 --> 00:01:27,740 And if we run this. 16 00:01:30,490 --> 00:01:32,530 Let me correct that real quick. 17 00:01:33,940 --> 00:01:40,690 And if we run this, it says our C string cannot be sent between threads safely. 18 00:01:41,530 --> 00:01:47,500 Now, remember, in the last section when we were talking about reference counter, I mentioned the 19 00:01:47,500 --> 00:01:49,270 atomic reference counter. 20 00:01:49,420 --> 00:01:54,400 So let's make this a atomic reference counter. 21 00:01:56,780 --> 00:02:00,740 Which I said is safe to use across threads. 22 00:02:00,740 --> 00:02:10,900 And now we are able to safely use a reference counter smart pointer inside of a thread. 23 00:02:10,910 --> 00:02:17,360 So I just wanted to make you aware of this because these two traits are important to help ensure rust 24 00:02:17,360 --> 00:02:20,180 is safe when using threads.