Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 709989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:33:53+00:00 2026-05-14T04:33:53+00:00

I would like to create/use a system-wide independent universal ‘counter object’ that can be

  • 0

I would like to create/use a system-wide independent universal ‘counter object’ that can be called via COM in a thread-safe manner.

The counter object will be passed an ID to identify which counter to return, handle the counting, ‘persist’ the count (occasionally), have reasonable performance (as fast as possible) perhaps capable of 1000 counts per second or better (1mS) and be accessible cross-process/out-of-process. The current count status must be persisted between object restarts/shutdowns.

The counter object is liklely to be a ‘singleton’ type object implemented in some form of free-threaded dictionary, containing maybe 10 counters (perhaps 50 max). The count needs to be monotonic and consistent, (ie: guaranteed unique sequential values).

Each counter should have a few methods, like reset, inc, dec, set, clear, remove. As a luxury, I would like to have a variable-increment (ie: ‘step by’ value). To support thread-safefty, perhaps some sorm of critical-section or mutex call. It just needs to return a long/4byte signed integer.

I really want something that can be called from anywhere, including VBScript, so I figure COM is my preferred solution.

The primary use of this is for database keys. I am unable to use autoinc or guid type keys and have ruled out database-generated counting systems at this point.

I’ve spent days researching this and I have really struggled to find a solution. The best I can find is a free-threaded dictionary object that can be instantiated using COM+ from Motobit – it seems to offer all the ‘basics’ and I guess I could create some form of wrapper for this.

So, here are my questions:

  • Does such a ‘general purpose
    counter-object already exist? Can you direct me to it? (MS did
    do an IIS/ASP object called
    ‘MSWC.Counter’ but this isn’t
    ‘cross-process’/ out-of-process
    component and isn’t thread-safe. (but if it was, it would do!)

  • What is the best way of creating such
    a Component? (I’d prefer VB6
    right-now, [don’t ask!] but can do in VB.NET2005
    if I had to). I don’t have the
    skills/knowledge/tools to use
    anything else.

I am desparate for a workable solution. I need specific guidance! If anybody can code something up for me I am prepared to pay for it.

Update:

  1. Whats wrong with GUIDs? a) 16bytes if I’m lucky (Binary storage), 32+bytes if I’m not (ANSI without formatting) or even worse(64bytes Unicode). b) I have an high-volume replicated app where the GUID is just too big (compared to the actual row data) and c) the overhead of indexing and inserts d) I want a readable number! – I only need 4 byte integer, so why not try and get that? I know you will say that disc-space is cheap, but for my application the cost is in slow inserts, and guids don’t help (and I have tried/tested) but would prefer not to use if I have a choice.

  2. Autonumber/autoincs are evil: a) don’t get the value until after the insert, b) session specific, c) easy to lose/screw up on a table alter, d) no good for mutli-table inserts, (its not MS-SQL Svr) plus I have a need for counters outside my DB…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:33:54+00:00Added an answer on May 14, 2026 at 4:33 am

    By the sound of it, what you’re looking to create is an ActiveX EXE. They run in their own process but can be accessed from any other process by instantiating an object from it as though it is just another COM object. It handles all the marshaling necessary to sync its internal thread with the threads of any process calling it. Since all you planning on using is integers, there’s no need to worry about the thread safety of objects passed between the threads.

    More than likely you can use the MSWC.Counter object within that ActiveX EXE and let it do the counter work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to create an application that would use the same system as
I would like to create one EMF object and use it in various Resource
I would like to create my font that use image icon instead of font
I would like to use create a rails route for a user's open id.
I would like to create a custom document library where I use the standard
I would like to create an XML-based website. I want to use XML files
We would like to use a cronjob to create a database backup. The backup
I'm trying to use the header() function to create a redirect. I would like
I'm trying to use twitter bootstrap to create Facebook like tooltip layout. I would
I would like to create a site-wide hash to be used as salt in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.