Fix a few deprecation warnings
This commit is contained in:
parent
4246f660ea
commit
c50b5b62ef
32 changed files with 53 additions and 65 deletions
|
|
@ -40,7 +40,7 @@ type
|
|||
|
||||
Actor[In, Out] = object{.pure, final.}
|
||||
i: Channel[Task[In, Out]]
|
||||
t: TThread[ptr Actor[In, Out]]
|
||||
t: Thread[ptr Actor[In, Out]]
|
||||
|
||||
PActor*[In, Out] = ptr Actor[In, Out] ## an actor
|
||||
{.deprecated: [TTask: Task, TActor: Actor].}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,6 @@ when hostOS == "solaris":
|
|||
|
||||
import os, parseutils
|
||||
from times import epochTime
|
||||
import unsigned
|
||||
|
||||
when defined(ssl):
|
||||
import openssl
|
||||
|
|
@ -703,7 +702,7 @@ proc getHostByAddr*(ip: string): Hostent {.tags: [ReadIOEffect].} =
|
|||
var s = posix.gethostbyaddr(addr(myaddr), sizeof(myaddr).Socklen,
|
||||
cint(posix.AF_INET))
|
||||
if s == nil:
|
||||
raiseOSError(osLastError(), $hstrerror(h_errno))
|
||||
raise newException(OSError, $hstrerror(h_errno))
|
||||
|
||||
result.name = $s.h_name
|
||||
result.aliases = cstringArrayToSeq(s.h_aliases)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
from pcre import nil
|
||||
import nre.private.util
|
||||
import tables
|
||||
import unsigned
|
||||
from strutils import toLower, `%`
|
||||
from math import ceil
|
||||
import options
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
## .. include:: ../doc/regexprs.txt
|
||||
##
|
||||
|
||||
{.deprecated.}
|
||||
|
||||
import
|
||||
pcre, strutils, rtarrays
|
||||
|
||||
|
|
|
|||
|
|
@ -456,7 +456,8 @@ proc bindAddr*(socket: AsyncSocket, port = Port(0), address = "") {.
|
|||
of AF_INET6: realaddr = "::"
|
||||
of AF_INET: realaddr = "0.0.0.0"
|
||||
else:
|
||||
raiseOSError("Unknown socket address family and no address specified to bindAddr")
|
||||
raise newException(OSError,
|
||||
"Unknown socket address family and no address specified to bindAddr")
|
||||
|
||||
var aiList = getAddrInfo(realaddr, port, socket.domain)
|
||||
if bindAddr(socket.fd, aiList.ai_addr, aiList.ai_addrlen.Socklen) < 0'i32:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#nim c -t:-march=i686 --cpu:amd64 --threads:on -d:release lockfreehash.nim
|
||||
|
||||
import unsigned, math, hashes
|
||||
import math, hashes
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
## Memory Utility Functions
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ proc distinguishedSlave(w: ptr Worker) {.thread.} =
|
|||
if w.q.len != 0: w.cleanFlowVars
|
||||
|
||||
var
|
||||
workers: array[MaxThreadPoolSize, TThread[ptr Worker]]
|
||||
workers: array[MaxThreadPoolSize, Thread[ptr Worker]]
|
||||
workersData: array[MaxThreadPoolSize, Worker]
|
||||
|
||||
distinguished: array[MaxDistinguishedThread, TThread[ptr Worker]]
|
||||
distinguished: array[MaxDistinguishedThread, Thread[ptr Worker]]
|
||||
distinguishedData: array[MaxDistinguishedThread, Worker]
|
||||
|
||||
when defined(nimPinToCpu):
|
||||
|
|
@ -468,7 +468,7 @@ proc nimSpawn3(fn: WorkerProc; data: pointer) {.compilerProc.} =
|
|||
await(gSomeReady)
|
||||
|
||||
var
|
||||
distinguishedLock: TLock
|
||||
distinguishedLock: Lock
|
||||
|
||||
initLock distinguishedLock
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
import unsigned
|
||||
|
||||
type
|
||||
MersenneTwister* = object
|
||||
mt: array[0..623, uint32]
|
||||
|
|
|
|||
|
|
@ -875,8 +875,9 @@ elif not defined(useNimRtl):
|
|||
var error: cint
|
||||
let sizeRead = read(data.pErrorPipe[readIdx], addr error, sizeof(error))
|
||||
if sizeRead == sizeof(error):
|
||||
raiseOSError("Could not find command: '$1'. OS error: $2" %
|
||||
[$data.sysCommand, $strerror(error)])
|
||||
raise newException(OSError,
|
||||
"Could not find command: '$1'. OS error: $2" %
|
||||
[$data.sysCommand, $strerror(error)])
|
||||
|
||||
return pid
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
# TODO: Docs.
|
||||
|
||||
import os, unsigned, hashes
|
||||
import os, hashes
|
||||
|
||||
when defined(linux):
|
||||
import posix, epoll
|
||||
|
|
@ -118,7 +118,7 @@ elif defined(linux):
|
|||
# are therefore constantly ready. (leading to 100% CPU usage).
|
||||
if epoll_ctl(s.epollFD, EPOLL_CTL_DEL, fd, nil) != 0:
|
||||
raiseOSError(osLastError())
|
||||
s.fds.mget(fd).events = events
|
||||
s.fds[fd].events = events
|
||||
else:
|
||||
var event = createEventStruct(events, fd)
|
||||
if s.fds[fd].events == {}:
|
||||
|
|
@ -129,7 +129,7 @@ elif defined(linux):
|
|||
else:
|
||||
if epoll_ctl(s.epollFD, EPOLL_CTL_MOD, fd, addr(event)) != 0:
|
||||
raiseOSError(osLastError())
|
||||
s.fds.mget(fd).events = events
|
||||
s.fds[fd].events = events
|
||||
|
||||
proc unregister*(s: var Selector, fd: SocketHandle) =
|
||||
if epoll_ctl(s.epollFD, EPOLL_CTL_DEL, fd, nil) != 0:
|
||||
|
|
@ -229,7 +229,7 @@ elif defined(macosx) or defined(freebsd) or defined(openbsd) or defined(netbsd):
|
|||
modifyKQueue(s.kqFD, fd, event, EV_ADD)
|
||||
for event in previousEvents-events:
|
||||
modifyKQueue(s.kqFD, fd, event, EV_DELETE)
|
||||
s.fds.mget(fd).events = events
|
||||
s.fds[fd].events = events
|
||||
|
||||
proc unregister*(s: var Selector, fd: SocketHandle) =
|
||||
for event in s.fds[fd].events:
|
||||
|
|
@ -298,7 +298,7 @@ elif not defined(nimdoc):
|
|||
proc update*(s: var Selector, fd: SocketHandle, events: set[Event]) =
|
||||
#if not s.fds.hasKey(fd):
|
||||
# raise newException(ValueError, "File descriptor not found.")
|
||||
s.fds.mget(fd).events = events
|
||||
s.fds[fd].events = events
|
||||
|
||||
proc unregister*(s: var Selector, fd: SocketHandle) =
|
||||
s.fds.del(fd)
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ proc slave(w: ptr Worker) {.thread.} =
|
|||
const NumThreads = 4
|
||||
|
||||
var
|
||||
workers: array[NumThreads, TThread[ptr Worker]]
|
||||
workers: array[NumThreads, Thread[ptr Worker]]
|
||||
workersData: array[NumThreads, Worker]
|
||||
|
||||
proc setup() =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue