forked from M-Labs/artiq
1
0
Fork 0

artiq/language/core.py: define print_rpc

This commit is contained in:
pca006132 2022-03-09 11:00:20 +08:00
parent 87154ea016
commit be3f05a4c0
1 changed files with 11 additions and 1 deletions

View File

@ -6,6 +6,7 @@ from typing import Generic, TypeVar
from functools import wraps from functools import wraps
from inspect import getfullargspec, getmodule from inspect import getfullargspec, getmodule
from types import SimpleNamespace from types import SimpleNamespace
from typing import TypeVar
from math import floor, ceil from math import floor, ceil
from artiq.language import import_cache from artiq.language import import_cache
@ -16,7 +17,8 @@ __all__ = [
"round64", "floor64", "ceil64", "round64", "floor64", "ceil64",
"extern", "kernel", "portable", "nac3", "rpc", "extern", "kernel", "portable", "nac3", "rpc",
"parallel", "sequential", "parallel", "sequential",
"set_watchdog_factory", "watchdog", "TerminationRequested" "set_watchdog_factory", "watchdog", "TerminationRequested",
"print_rpc"
] ]
@ -106,6 +108,14 @@ def rpc(arg=None, flags={}):
return inner_decorator return inner_decorator
return arg return arg
T = TypeVar('T')
@rpc
def print_rpc(a: T):
print(a)
@nac3 @nac3
class KernelContextManager: class KernelContextManager:
@kernel @kernel