feat(auth): 添加完整的用户认证API项目
- 实现用户注册、登录、JWT令牌认证功能 - 集成Gin、GORM、Viper、Zap等框架 - 添加密码加密、数据库操作、中间件等完整功能 - 配置多环境支持、日志轮转、CORS处理 - 创建完整的项目结构和配置文件体系
This commit is contained in:
24
go并发模型/06go-atomic-cpu/cpu_busy_loop.go
Normal file
24
go并发模型/06go-atomic-cpu/cpu_busy_loop.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var stop int32 = 0
|
||||
|
||||
go func() {
|
||||
for atomic.LoadInt32(&stop) == 0 {
|
||||
// 忙等:什么也不干,不让出 CPU
|
||||
}
|
||||
fmt.Println("worker 退出")
|
||||
}()
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
fmt.Println("main: 设置 stop=1")
|
||||
atomic.StoreInt32(&stop, 1)
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
Reference in New Issue
Block a user