thread1 thread2
| | wait
do_my_job | |
| |
notify_one |----------->|
| | wakeup
do_my_job | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <numeric> | |
#include <gtest/gtest.h> | |
TEST(test_copy_if, TestOdd) | |
{ | |
std::vector<int> v1(10); | |
std::vector<int> v2(5); | |
std::iota(v1.begin(), v1.end(), 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
class C | |
{ | |
private: | |
int _data; | |
public: | |
C(int data) { | |
_data = data; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"files.exclude": { | |
"**/exclude_path1": true, | |
"**/exclude_path2": true | |
}, | |
"search.exclude": { | |
"**/exclude_path1": true, | |
"**/exclude_path2": true | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// https://exercism.org/tracks/rust/exercises/reverse-string/iterations?idx=1 | |
/// 함수형으로 쉽게 할 수 있으나 문제 의도에 맞춰 iteration으로 만듬 | |
/// 기초적인 언어 문제를 다시 생각할 수 있게 되서 좋았음 | |
pub fn reverse(input: &str) -> String { | |
//input.chars().rev().collect() | |
let len = input.len(); | |
let mut s = String::with_capacity(input.len()); | |
for c in input.chars().rev() { | |
s.push(c); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
#include <thread> | |
/** | |
# 성능 측정을 위한 간단히 ms 단위 측정 코드 | |
- C++11 코드로 작성 | |
- 명확하게 하기 위해 일부러 namespace는 사용하지 않음 | |
- chrono_literals 의 ms 등 편리한 operator는 C++14부터 사용 가능 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[VT numeric keypad] | |
;Num pad 0 key | |
Num0=off | |
;Num pad 1 key | |
Num1=off | |
;Num pad 2 key | |
Num2=off | |
;Num pad 3 key | |
Num3=off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <chrono> | |
#include <thread> | |
#include <mutex> | |
#include <condition_variable> | |
/// compile : g++ -std=c++11 -pthread cv_test.cpp -o cv_test && ./cv_test | |
std::condition_variable _cv; | |
std::mutex _mutex; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The rust by example ko https://hanbum.gitbooks.io/rustbyexample/content/fn/closures/input_parameters.html | |
compiled on https://play.rust-lang.org/ | |
Fn 클로저는 참조로 획득 (&T) | |
FnMut 클로저는 가변참조로 획득 (&mut T) | |
FnOnce 클로저는 값으로 획득 (T) | |
... | |
이해가 잘 안되네.. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
The rust by example ko https://hanbum.gitbooks.io/rustbyexample/content/fn/closures/capture.html | |
compiled on https://play.rust-lang.org/ | |
result : | |
*/ | |
fn main() | |
{ | |
use std::mem; | |