blocking

C++ object termination notification

In a C++ program, I have two reference counted objects: King and Heir. Heir needs to block until King is destroyed. King is a reference counted object which will be destroyed when it's reference count goes to zero. If Heir holds a reference to King, then King's reference count will never go to zero. How can have Heir block until King...

Blocking a record from editing while another user is editing the record - how?

I'm trying to add record locking to a site. This isn't database locking where I have 2 processes editing the same record at the same time, but instead 2 users editing the same record at the same time. Here's the situation: I need to be able to lock a record while 1 person is editing it so someone else can make changes to record at the s...

Non-blocking socket with poll

A couple of days ago I had to investigate a problem where my application was showing abnormally high CPU usage when it was (apparently) in idle state. I tracked the problem down to a loop which was meant to block on a recvfrom call while the socket had been set to O_NONBLOCK-ing resulting in a spin lock. There were two ways of solving th...

Long process blocks waiting icon render in ExtJS

The feature I'm implementing is not a really required, so I won't include an extra library of threads just for that. But if someone knows a workaround I will appreciate it. So I have a grid of 256 rows and 3 columns; one those columns is a checkboxColumn (similar to the one used here). But that checkboxColumn plugin has being modified t...

Outlook does not display embeded images and HTML in emails sent using Java.

I am writing a program that sends a HTML newsletter to a bunch of people. Currently, the way this is done is to create the html, and replace all images with cid:#### references. This is then sent to users using the Apache Commons Email library. The code for this follows: public boolean Mail(HttpServletRequest request) { try { HtmlEm...

Locking a mercurial branch before release

How do I lock the entire branch of a mercurial? I get this requirements normally before the release... ...

How to prevent ad blocker from blocking ads on an app

One of my users let the cat out of the bag and told me they were using one of my free apps, which is monetized by ads, but they were blocking the ads with an ad blocker. They told me this mockingly, as if I can't do anything about it. Can I do something about it? Is there a way to detect that ads are being blocked? ...

Super slow apps caused by large number of unending AsyncTasks

I have no idea, but my app is stalling sometimes completely (not responding to touching the screen) I thought I was following all the rules for threading, but my app is apparently slowing down the Sprint EVO! I have never used an app as slow as my own. I don't get an ANR dialog, though I think I probably should get getting one. I have ...

How to Create/Run AsyncTask in Service without runOnUiThread()

I have a Service that creates AsyncTasks for downloading files. In activities, we create Runnables or Threads that we pass to Activity.runOnUiThread(). I can't access that method from a service, so how do I use AsyncTask correctly, (do heavy work without blocking the UI Thread)? ...

What's the principle of blocking mode?

Like blocks until the file is done playing, what's the principle and how to implement this? ...

how to create a blocking function

Hi all. I have a thread that needs to dispatch a message (a simulated mouse event that it sends using SendInput) as soon as it's generated. I want this to happen in a loop where there is no sleep; adding any sleep hurts performance as I basically want the events to go in to the event loop immediately once they have been generated. Of co...

DoDragDrop() from another thread

Every time i want let the user to drag an control, i calling DoDragDrop of that control. The drag & drop works fine, but i have problem with things around: DoDragDrop completely blocking the form, no timer events jumps, no paint messages handled. DoDragDrop blocking not only for the drag & drop operation, but until target program fini...

Two transactions seem to block each other but none of them is waiting

I have two transactions running in a mysql database, neither of which seems to make any progress. Both hold some locks but as far as I understand they don't conflict. Both transactions are in state "ACTIVE" (I would have expected that one of them be in a waiting state if it were blocked by the other). I've attached the "TRANSACTIONS" ...

Blocking until event

In a web worker, I'm firing off a postMessage() and need to wait for the result before continuing execution. Is there anyway of blocking until the onMessage event occurs, short of busy waiting plus something like Peterson's Algorithm? ...

Piped Stream Issue in Freemarker

I need to load and process a template in freemarker. I am using a piped stream to read back the generated result by freemarker. Sample code: PipedInputStream pi = new PipedInputStream(); PipedOutputStream po = new PipedOutputStream(pi); Writer writer = new OutputStreamWriter(po); configuration.getTemplate("xx").process(rootMap, writer...

Google adsense look alike

Hi im looking for an advertising program like google adsense but one that does not prohibit me from offering compensation to users for viewing ads. Thanks. ...

Using delphi to block websites

I Program my local schools program launcher which allows students to get on the internet with an randomly generated key provided by a teacher. This is done by changing the proxy in Internet explorer to the one needed for the internet and the wb filter. With the schools website and learning resources gradually moving to offsite hosting t...

Block images from loading in webbrowser with site exceptions.

I'm currently blocking all images from loading in the webbrowser control by using this registry key. I would like to find a way were i could allow images from some sites to be shown. Any help would be welcome ...

how efficient is locking an unlocked mutex? how much does a mutex costs?

Hi, In a low level language (C, C++ or whatever): I have the choice in between either having a bunch of mutexes (like what pthread gives me or whatever the native system library provides) or a single one for an object. How efficient is it to lock a mutex? I.e. how much assembler instructions are there likely and how much time do they t...

C++ Threads and Simple blocking mechanism?

I have a program in C++ that runs a bunch of threads to manipulate the same data. Each of these threads have a pointer to an object that is being manipulated, for example: thread1 and thread2 both have a pointer to object1 object1->addSomething() can be used by either thread1 or 2 and refer to the same object Now, these operations migh...