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 7778137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:19:16+00:00 2026-06-01T18:19:16+00:00

I am working on a Messenger library. The main class has a Login method.

  • 0

I am working on a Messenger library. The main class has a Login method. When logging in, all contact list data is downloaded and stored until the Login has completed, at which point I raise a UserAdded event for each user that was downloaded.

Currently I raise the events right at the end of the Login method, one by one. This works, but it means if I perform a lengthy operation inside a UserAdded event handler, the library consumer does not get their events in a timely fashion.

One way around this I can see would be to raise each event asynchronously, but this would thrash the threadpool.

Am I doing it the right way currently? Should I simply make a note in the documentation warning against performing lengthy operations inside event handlers?

  • 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-06-01T18:19:17+00:00Added an answer on June 1, 2026 at 6:19 pm

    Perhaps you might want to change your event handler to simply “enqueue” into a threadsafe queue work items. You can then have a single thread which pumps the queue continuously to actually process the messages. That way the raise happens very quickly and there is only one thread actually processing the queue of work items.

    However doing this means you now have to deal with the fact that raising your event does not mean it has been immediately processed, which could affect logic you have in your app.

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

Sidebar

Related Questions

I'm working on a library for the .NET messenger service. It has a connection
I'm working on an instant messenger client in C++ (Win32) and I'm experimenting with
I'm currently working on trying to create a very basic bare bones instant messenger
Working in an app where a page_title method was defined in application_helper.rb as such:
I am working on creating a C# P2P chat messenger without a central server.
Working with SSRS and a SQL 2000 source, I have a stored procedure that
Working with MVC 2 ad with the help of some friends I thought all
I'm working on a networked application that has a peer-to-peer file transfer component (think
Working on a legacy application at the moment and we are replacing the data
I am working on a simple messenger using JSF and PrimeFaces. I would like

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.