Go Back   Cockos Incorporated Forums > Other Software Discussion > OSCII-bot forum

Thread Tools Display Modes
Old 02-03-2016, 01:10 AM   #1
Human being with feelings
Join Date: Feb 2016
Posts: 143
Default OSC variable scope and OSCII-bot time scheduling explanation request

Having a real hard time with a single OSC script in OSCII-bot that is misbehaving causing flaky functionality of a Midi Control Surface.

On what basis does OSCII-bot schedule its @oscmsg, @midimsg and @timer code sections?

The problem is that key global variables needed to communicate/share data between @sections appear to be being updated & read asynchronously on different threads of execution. Unclear or undefined scheduling or re-entrancy of the @midimsg and @oscmsg sections is giving timing overlap related functionality bugs.

Assuming that every variable is truly global (except when explicitly declared as local) as stated here http://www.cockos.com/oscii-bot/oscii-bot-doc.html then how does the scheduling of the @sections work?

If a thread is part way through processing slowish code in @midimsg how and when does @oscmsg get called?, or is there a scheduler based on

a) all code is single threaded on a time slice that allows an @section to complete along with periodically running @timer
or perhaps
b) thread is interrupted and another thread executed as OSC data comes in to the network port's buffers

Given the functional but rudimentary OSCII-bot runtime and debug environment (a statement: but not a complaint!) it would be really useful to know this scheduling from "as documented behaviour" rather than spend a very long time experimenting and reverse engineering timing behaviours. The OSCII-bot source code suggests an answer somewhere in the mainProc function of midi2osc.cpp : but code reading has not yielded what is going on! Thanks

Last edited by goldenarpharazon; 02-06-2016 at 03:11 PM.
goldenarpharazon is offline   Reply With Quote
Old 02-06-2016, 03:11 PM   #2
Human being with feelings
Join Date: Feb 2016
Posts: 143
Default OSCII-bot timing insight

The thread ordering and sequence was gradually determined by using diagnostic debug printf() output to the OSCII-bot console log and by logging precise times using the time_precise() function call in the debug log.

The @midimsg and @oscmsg sections seem completely exclusive of one another and run on the same thread. Only one or the other runs at any one time making global variables thread safe within a script.

OSCII-bot coders relying on time and sequencing should note that in the standard console messages like this

TIME: 531.917 [OSC input] /fxparam/11/name [s] 1: Volume

that "TIME" here uses a less precise time stamp that does not always increment with wall clock time.
goldenarpharazon is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -7. The time now is 05:17 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.