Click here to Skip to main content
Click here to Skip to main content

Timers & Sockets

, 7 Apr 2005
Rate this:
Please Sign up or sign in to vote.
Control of timers, timings, offered services, and used services.

Sample Image

Introduction

BOS contains the functionality of the TIM and SOC sub-systems. Seventeen additional routines are provided to satisfy application program requirements in a C/C++ and VB environment. The praxis is that 150TIM+400SOC slots are enough for an application.

Background

Each slot may be set up to signal an event-flag, execute a function, or spin-off a thread; with or without a parameter. A slot is allocated a number (i.e., 1 to 550) on creation. Slots may be removed by slot-number.

Initialization is done when the first call to any relevant routine is made. A slot is set up using make_slot. A slot is destroyed using remove_slot. The BOS sub-system is de-initialized using reset. The user facilitates the actions by calling await_slot.

When a slot is signaled, its actions are performed, unless its action is ‘to return from await_slot’ and we are not in await_slot. When we are, then it will.

A process is expected to set up its slot requirements from any of its threads and then some of these threads spend their time in await_slot. When a thread returns from await_slot, for other than a timeout reason, it will be because a signaled state that has no function or thread entry setup in the relevant slot group has occurred. Having actioned this signaled state, the thread should recall await_slot. Perhaps a common usage will have all slot entries with a function or thread entry point so that the only return from await_slot will be for a timeout reason.

The 'await' and nine 'make' calls take a group number. This allows sub-sets of the collection of slots to be waited on, perhaps by different threads.

Using the code

VC 6.0 projects:

  • Place the BOSDLL.dll in a directory on your path variable.
  • Add the library BOSDLL.lib to the project resources.
  • Add the modules BOScalls.h, SOCcalls.h and TIMcalls.h to the project.
  • Use the routines therein.

VB 6.0 projects:

  • Register the BOSDLL.dll with regsvr32.
  • Add the modules BOSDLL.bas, SOCDLL.bas and TIMDLL.bas to the project.
  • Use the public routines therein.
//
// Source code to produce the above console screen
// is to be found in the 1st of the 3 demo C/C++ projects.
//

History

  • 3.4 - BOS_Src.cpp - Comment/Logging maintenance.
  • 3.3 - For C/C++ only users, a static library can be built using the workspace and the project files provided.
  • 3.2 - Server-side 'select' timeout is reduced from 50 to 1 millisecond. This allows faster transfer, though one's machine will get busier.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Lymington
Web Developer
United Kingdom United Kingdom
BSc (St.Andrews(1963-67))
MSCE
Systems Programmer 39+yrs
Married to first wife 35yrs & counting, four grown-up children
Religious opinions similar to MelG's
It is not the gnosis, but the praxis must be the fruit. (Aristotle)

Comments and Discussions

 
General[Message Deleted] Pinmemberit.ragester2-Apr-09 21:53 
GeneralMarried to first wife... PinmemberGeorge L. Jackson20-Apr-04 10:34 
GeneralRe: Married to first wife... PinmemberLymington28-Apr-04 12:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.141022.1 | Last Updated 8 Apr 2005
Article Copyright 2004 by Lymington
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid