Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
null-directory committed Apr 24, 2020
2 parents e2765c2 + 14527e5 commit a841ffa
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,12 @@ The having something act as its value while _being distinguishable_ from that va

For testing purposes, it's helpful to not need to constantly redefine things. In code examples (as already seen) these can be called upon to provide a repeatable/demonstratable input. Plus, they're used by the tests.

### global

Ever do work in one section of Ignition and wish you could exploit it in another? Tired of lag due to recalculating the same data over and over in different contexts? Use `ExtraGlobal` to cache objects for anything to reference in the JVM. It monitors itself and keeps track of its entries, purging (or updating) them as they time out. Handy if you have an event driven by a tag that you want to show in Perspective and reference in WebDev.

> WARNING: This is clearly best used for objects that are immutable, but there's nothing stopping you from using this as a weird, thread-unsafe pipe between threads. Don't use it for that. Unless you have a really good reason or are making something really cool.

### logging

Logging in Ignition comes in many flavors and scenarios. And yet, there are a few caveats. Can't use `system.util.getLogger` effectively in the script console, defining loggers and their contexts can be verbose, and getting clients to log to the gateway is occasionally super helpful. This logging class lets you put as little or as much effort into this as you'd like.
Expand Down Expand Up @@ -237,6 +243,14 @@ def foo(x):
```
Note also that the function returns the thread handle itself. See the docstring for the decorator for more details on how that works.

Additionally, the thread can be named with `name=`. Setting `maxAllowedRuntime=` will _make sure_ the thread dies in a certain amount of time. If you're worried an async thread will live past its prime, this is an easy way to make sure it's not there. Eventually.

Also added is `findThreads` which will return a list of named threads matching a pattern given (i.e. regex).

And for those cheating off other thread's work, you can use `getThreadObject` to get a live reference to something in another thread.
> WARNING: Grabbing and mutating objects _from outside threads_ is sheer lunacy and is beyond bad practice! This function exists to make `ExtraGlobal` functional and to overcome a few extremely niche edge cases in how Jython operates (as compared to, say, CPython).


### timing

If you need to run something in a loop, but don't want to use a timer component, these classes should help.
Expand Down Expand Up @@ -303,4 +317,4 @@ The `SparkplugBPayload` class here adds a helper function to the payload definit

Please open an issue if there's any problems with the scripts. If you have corrections or additional features submit them or provide a pull request. Anything pulled in will be listed here. Thanks!

> Written with [StackEdit](https://stackedit.io/).
> Written with [StackEdit](https://stackedit.io/).

0 comments on commit a841ffa

Please sign in to comment.