본문 바로가기

Code Habit

검색하기
Code Habit
프로필사진 코드베어

  • 분류 전체보기 (203)
Guestbook
Notice
Recent Posts
Recent Comments
Link
«   2025/08   »
일 월 화 수 목 금 토
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
Tags
  • 리뷰
  • package
  • json
  • c++
  • go
  • tcp
  • http
  • Callback
  • channel
  • JavaScript
  • Close
  • install
  • C
  • Python
  • go언어
  • API
  • write
  • mutex
  • File
  • Linux
  • Sync
  • bitcoin
  • 영화
  • FOR
  • Golang
  • GO 언어
  • windows
  • range
  • 책
  • window
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록do (1)

Code Habit

Go ) sync.Once

Once를 사용하면 함수를 한 번만 실행할 수 있다. Sync 패키지에서 제공하는 Once의 구조체와 함수는 다음과 같다. Sync.Once func (*Once) Do(f func()) : 함수를 한번만 실행 사용예제이다. package main import ( "fmt" "runtime" "sync" ) func hello() { fmt.Println("Hello, world!") } func main() { runtime.GOMAXPROCS(runtime.NumCPU()) // 모든 CPU 사용 once := new(sync.Once) // Once 생성 for i := 0; i

카테고리 없음 2020. 6. 11. 08:13
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바