Skip to content

Commit

Permalink
Workaround for #96, Issue with poll on boot
Browse files Browse the repository at this point in the history
We can't start polling right after a gpio has been exported (...).
As always with this kind of infamous workarounds, a proper fix would be better.
  • Loading branch information
uraimo committed Oct 21, 2019
1 parent c99a373 commit 4231ec1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Sources/SwiftyGPIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ fileprivate extension GPIO {
//Ignored by Linux
guard #available(iOS 10.0, macOS 10.12, *) else {return nil}

usleep(100000) //100ms sleep: Workaround for poll blocking forever the first time the poll a gpio after boot

let thread = Thread {

let gpath = GPIOBASEPATH+"gpio"+String(self.id)+"/value"
Expand Down

0 comments on commit 4231ec1

Please sign in to comment.