473,781 Members | 2,732 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GUI Invoke stalls thread

Hi,

I hope someone can help. I have written a simple form to demonstrate
my problem/question. The code follows.

The form starts a thread, which using delegates updates a label (Every
second adds another dot to the label). This works great. However,
when I put the GUI thread to sleep (Thread.Sleep), the thread seems to
stall. At first I was expecting dots to still appear, but obviously as
the GUI thread is asleep, they will not. However, the thread never
hits my break points once the GUI thread is asleep. Am I invoking
incorrectly? Any help appreciated.

Kev

using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
using System.Threadin g;

namespace WindowsApplicat ion2
{
public delegate void MyDelegate();

public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Label label1;
private System.Windows. Forms.Button button1;
private System.Componen tModel.Containe r components = null;

public Form1()
{
InitializeCompo nent();
}

private void UpdateLabel()
{
if (this.label1.In vokeRequired)
this.label1.Inv oke(new MyDelegate(this .UpdateLabel));
else
this.label1.Tex t += ". ";
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.label1 = new System.Windows. Forms.Label();
this.button1 = new System.Windows. Forms.Button();
this.SuspendLay out();
//
// label1
//
this.label1.Fon t = new System.Drawing. Font("Microsoft Sans
Serif", 15.75F, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, ((System.Byte)( 0)));
this.label1.Loc ation = new System.Drawing. Point(40, 32);
this.label1.Nam e = "label1";
this.label1.Siz e = new System.Drawing. Size(232, 96);
this.label1.Tab Index = 0;
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(80, 168);
this.button1.Na me = "button1";
this.button1.Si ze = new System.Drawing. Size(96, 32);
this.button1.Ta bIndex = 1;
this.button1.Te xt = "button1";
this.button1.Cl ick += new
System.EventHan dler(this.butto n1_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(292, 266);
this.Controls.A dd(this.button1 );
this.Controls.A dd(this.label1) ;
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}

private void button1_Click(o bject sender, System.EventArg s e)
{
Worker w = new Worker();
w.m_delegate = new MyDelegate(this .UpdateLabel);
Thread t = new Thread(new ThreadStart(w.D oSomething));
t.Start();
Thread.Sleep(20 000);
}
}

//
// work class
//
class Worker
{
public MyDelegate m_delegate = null;

public void DoSomething()
{
while (true)
{
Thread.Sleep(10 00);
m_delegate();
}
}
}

} // end of namespace

Oct 19 '06 #1
6 2821
Your "UpdateLabe l" method has to run on the UI thread, but you put your UI
thread to sleep in your Click handler, that is, you block your UI threa, the
UpdateLabel method will only execute when the Click handler returns, that is
after 20 seconds.
Remove the Sleep call and you are done.

Willy.
<k.******@iee.o rgwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
| Hi,
|
| I hope someone can help. I have written a simple form to demonstrate
| my problem/question. The code follows.
|
| The form starts a thread, which using delegates updates a label (Every
| second adds another dot to the label). This works great. However,
| when I put the GUI thread to sleep (Thread.Sleep), the thread seems to
| stall. At first I was expecting dots to still appear, but obviously as
| the GUI thread is asleep, they will not. However, the thread never
| hits my break points once the GUI thread is asleep. Am I invoking
| incorrectly? Any help appreciated.
|
| Kev
|
|
|
| using System;
| using System.Drawing;
| using System.Collecti ons;
| using System.Componen tModel;
| using System.Windows. Forms;
| using System.Data;
| using System.Threadin g;
|
| namespace WindowsApplicat ion2
| {
| public delegate void MyDelegate();
|
| public class Form1 : System.Windows. Forms.Form
| {
| private System.Windows. Forms.Label label1;
| private System.Windows. Forms.Button button1;
| private System.Componen tModel.Containe r components = null;
|
| public Form1()
| {
| InitializeCompo nent();
| }
|
| private void UpdateLabel()
| {
| if (this.label1.In vokeRequired)
| this.label1.Inv oke(new MyDelegate(this .UpdateLabel));
| else
| this.label1.Tex t += ". ";
| }
|
| protected override void Dispose( bool disposing )
| {
| if( disposing )
| {
| if (components != null)
| {
| components.Disp ose();
| }
| }
| base.Dispose( disposing );
| }
|
|
| #region Windows Form Designer generated code
| /// <summary>
| /// Required method for Designer support - do not modify
| /// the contents of this method with the code editor.
| /// </summary>
| private void InitializeCompo nent()
| {
| this.label1 = new System.Windows. Forms.Label();
| this.button1 = new System.Windows. Forms.Button();
| this.SuspendLay out();
| //
| // label1
| //
| this.label1.Fon t = new System.Drawing. Font("Microsoft Sans
| Serif", 15.75F, System.Drawing. FontStyle.Bold,
| System.Drawing. GraphicsUnit.Po int, ((System.Byte)( 0)));
| this.label1.Loc ation = new System.Drawing. Point(40, 32);
| this.label1.Nam e = "label1";
| this.label1.Siz e = new System.Drawing. Size(232, 96);
| this.label1.Tab Index = 0;
| //
| // button1
| //
| this.button1.Lo cation = new System.Drawing. Point(80, 168);
| this.button1.Na me = "button1";
| this.button1.Si ze = new System.Drawing. Size(96, 32);
| this.button1.Ta bIndex = 1;
| this.button1.Te xt = "button1";
| this.button1.Cl ick += new
| System.EventHan dler(this.butto n1_Click);
| //
| // Form1
| //
| this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
| this.ClientSize = new System.Drawing. Size(292, 266);
| this.Controls.A dd(this.button1 );
| this.Controls.A dd(this.label1) ;
| this.Name = "Form1";
| this.Text = "Form1";
| this.ResumeLayo ut(false);
|
| }
| #endregion
|
| /// <summary>
| /// The main entry point for the application.
| /// </summary>
| [STAThread]
| static void Main()
| {
| Application.Run (new Form1());
| }
|
| private void button1_Click(o bject sender, System.EventArg s e)
| {
| Worker w = new Worker();
| w.m_delegate = new MyDelegate(this .UpdateLabel);
| Thread t = new Thread(new ThreadStart(w.D oSomething));
| t.Start();
| Thread.Sleep(20 000);
| }
|
|
| }
|
| //
| // work class
| //
| class Worker
| {
| public MyDelegate m_delegate = null;
|
| public void DoSomething()
| {
| while (true)
| {
| Thread.Sleep(10 00);
| m_delegate();
| }
| }
| }
|
| } // end of namespace
|
Oct 19 '06 #2
Willy,

many thanks for your reply. I fully understand your answer. Perhpas
I am not stating the task clearly enough. I have deliberately put the
GUI thread to sleep to illustrate the problem I want to solve. Evn
though the GUI thread is alseep, I would still expect the worker thread
to continue executing.

So if the GUI thread thread sleeps for 20 seconds, and the worker
ticks over once a second, I would expect the worker to hit a breakpoint
(loop) 20 times whilst the GUI is asleep.

However, the worker thread seems to get blocked. I appreciate that
whilst the gui is sleeping the label will not get updated, but
shouldn't the 20 worker thread loops get queued? At the moment the
worker thread stops, which from my understaning defeats the object of
test InvokeRequired/Invoke().

Any thoughts would be helpful.

Thanks again.
Willy Denoyette [MVP] wrote:
Your "UpdateLabe l" method has to run on the UI thread, but you put your UI
thread to sleep in your Click handler, that is, you block your UI threa, the
UpdateLabel method will only execute when the Click handler returns, that is
after 20 seconds.
Remove the Sleep call and you are done.

Willy.
<k.******@iee.o rgwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
| Hi,
|
| I hope someone can help. I have written a simple form to demonstrate
| my problem/question. The code follows.
|
| The form starts a thread, which using delegates updates a label (Every
| second adds another dot to the label). This works great. However,
| when I put the GUI thread to sleep (Thread.Sleep), the thread seems to
| stall. At first I was expecting dots to still appear, but obviously as
| the GUI thread is asleep, they will not. However, the thread never
| hits my break points once the GUI thread is asleep. Am I invoking
| incorrectly? Any help appreciated.
|
| Kev
|
|
|
| using System;
| using System.Drawing;
| using System.Collecti ons;
| using System.Componen tModel;
| using System.Windows. Forms;
| using System.Data;
| using System.Threadin g;
|
| namespace WindowsApplicat ion2
| {
| public delegate void MyDelegate();
|
| public class Form1 : System.Windows. Forms.Form
| {
| private System.Windows. Forms.Label label1;
| private System.Windows. Forms.Button button1;
| private System.Componen tModel.Containe r components = null;
|
| public Form1()
| {
| InitializeCompo nent();
| }
|
| private void UpdateLabel()
| {
| if (this.label1.In vokeRequired)
| this.label1.Inv oke(new MyDelegate(this .UpdateLabel));
| else
| this.label1.Tex t += ". ";
| }
|
| protected override void Dispose( bool disposing )
| {
| if( disposing )
| {
| if (components != null)
| {
| components.Disp ose();
| }
| }
| base.Dispose( disposing );
| }
|
|
| #region Windows Form Designer generated code
| /// <summary>
| /// Required method for Designer support - do not modify
| /// the contents of this method with the code editor.
| /// </summary>
| private void InitializeCompo nent()
| {
| this.label1 = new System.Windows. Forms.Label();
| this.button1 = new System.Windows. Forms.Button();
| this.SuspendLay out();
| //
| // label1
| //
| this.label1.Fon t = new System.Drawing. Font("Microsoft Sans
| Serif", 15.75F, System.Drawing. FontStyle.Bold,
| System.Drawing. GraphicsUnit.Po int, ((System.Byte)( 0)));
| this.label1.Loc ation = new System.Drawing. Point(40, 32);
| this.label1.Nam e = "label1";
| this.label1.Siz e = new System.Drawing. Size(232, 96);
| this.label1.Tab Index = 0;
| //
| // button1
| //
| this.button1.Lo cation = new System.Drawing. Point(80, 168);
| this.button1.Na me = "button1";
| this.button1.Si ze = new System.Drawing. Size(96, 32);
| this.button1.Ta bIndex = 1;
| this.button1.Te xt = "button1";
| this.button1.Cl ick += new
| System.EventHan dler(this.butto n1_Click);
| //
| // Form1
| //
| this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
| this.ClientSize = new System.Drawing. Size(292, 266);
| this.Controls.A dd(this.button1 );
| this.Controls.A dd(this.label1) ;
| this.Name = "Form1";
| this.Text = "Form1";
| this.ResumeLayo ut(false);
|
| }
| #endregion
|
| /// <summary>
| /// The main entry point for the application.
| /// </summary>
| [STAThread]
| static void Main()
| {
| Application.Run (new Form1());
| }
|
| private void button1_Click(o bject sender, System.EventArg s e)
| {
| Worker w = new Worker();
| w.m_delegate = new MyDelegate(this .UpdateLabel);
| Thread t = new Thread(new ThreadStart(w.D oSomething));
| t.Start();
| Thread.Sleep(20 000);
| }
|
|
| }
|
| //
| // work class
| //
| class Worker
| {
| public MyDelegate m_delegate = null;
|
| public void DoSomething()
| {
| while (true)
| {
| Thread.Sleep(10 00);
| m_delegate();
| }
| }
| }
|
| } // end of namespace
|
Oct 19 '06 #3

<k.******@iee.o rgwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
| Willy,
|
| many thanks for your reply. I fully understand your answer. Perhpas
| I am not stating the task clearly enough. I have deliberately put the
| GUI thread to sleep to illustrate the problem I want to solve. Evn
| though the GUI thread is alseep, I would still expect the worker thread
| to continue executing.
|
| So if the GUI thread thread sleeps for 20 seconds, and the worker
| ticks over once a second, I would expect the worker to hit a breakpoint
| (loop) 20 times whilst the GUI is asleep.
|
| However, the worker thread seems to get blocked. I appreciate that
| whilst the gui is sleeping the label will not get updated, but
| shouldn't the 20 worker thread loops get queued?
No, because you call Invoke, which is synchronous, which means it wait's
until the posted message (and the associated delegate) has been handled.
You need to call the asynchronous version BeginInvoke instead.
Sorry if I wasn't entirely clear in my previous answer.

Willy.
Oct 19 '06 #4
I have posted a new code sample below, which is neaer my real world
problem. I have removed the Thread.Sleep call to remove any
complications - I am not certain how this affects my previous code.

The code below has an additional delegate which is called after 10s.
Every second the label is updated. After 10s a MessageBox is shown on
screen via InvokeRequired/Invoke().
The worker thread is programmed to run for 20s and write the numbers 1
- 20 to the file, closing the file every time.

However, whilst the message box is on screen the worker thread appears
to blocked. The numbers 11 - 20 are not written to the file.

Can anyone help me interpret this behaviour, and get the behaiour I
desire?

Thanks all

using System;
using System.Drawing;
using System.Collecti ons;
using System.Componen tModel;
using System.Windows. Forms;
using System.Data;
using System.Threadin g;
using System.IO;

namespace WindowsApplicat ion2
{
public delegate void MyDelegate();

/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows. Forms.Form
{
private System.Windows. Forms.Label label1;
private System.Windows. Forms.Button button1;
private System.Componen tModel.Containe r components = null;

public Form1()
{
InitializeCompo nent();
}

private void Form1_Load(obje ct sender, System.EventArg s e)
{

}

private void UpdateLabel()
{
if (this.label1.In vokeRequired)
this.label1.Inv oke(new MyDelegate(this .UpdateLabel));
else
this.label1.Tex t += ". ";
}

private void ShowMessageBox( )
{
if (this.InvokeReq uired)
this.Invoke(new MyDelegate(this .ShowMessageBox ));
else
MessageBox.Show ("Hello");
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Disp ose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.label1 = new System.Windows. Forms.Label();
this.button1 = new System.Windows. Forms.Button();
this.SuspendLay out();
//
// label1
//
this.label1.Fon t = new System.Drawing. Font("Microsoft Sans
Serif", 15.75F, System.Drawing. FontStyle.Bold,
System.Drawing. GraphicsUnit.Po int, ((System.Byte)( 0)));
this.label1.Loc ation = new System.Drawing. Point(40, 32);
this.label1.Nam e = "label1";
this.label1.Siz e = new System.Drawing. Size(232, 96);
this.label1.Tab Index = 0;
//
// button1
//
this.button1.Lo cation = new System.Drawing. Point(80, 168);
this.button1.Na me = "button1";
this.button1.Si ze = new System.Drawing. Size(96, 32);
this.button1.Ta bIndex = 1;
this.button1.Te xt = "button1";
this.button1.Cl ick += new
System.EventHan dler(this.butto n1_Click);
//
// Form1
//
this.AutoScaleB aseSize = new System.Drawing. Size(5, 13);
this.ClientSize = new System.Drawing. Size(292, 266);
this.Controls.A dd(this.button1 );
this.Controls.A dd(this.label1) ;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHan dler(this.Form1 _Load);
this.ResumeLayo ut(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run (new Form1());
}

private void button1_Click(o bject sender, System.EventArg s e)
{
Worker w = new Worker();
w.m_delegate = new MyDelegate(this .UpdateLabel);
w.m_delegate2 = new MyDelegate(this .ShowMessageBox );
Thread t = new Thread(new ThreadStart(w.D oSomething));
t.Start();
}
}

//
// work class
//
class Worker
{
public MyDelegate m_delegate = null;
public MyDelegate m_delegate2 = null;

public void DoSomething()
{
TextWriter tw = new StreamWriter("C :\\red.txt");
tw.Close();
int i = 0;
while (true)
{
tw = new StreamWriter("C :\\red.txt", true);
i++;
Thread.Sleep(10 00);
tw.WriteLine(i) ;
tw.Close();
//if (i < 10)
m_delegate();
else if (i == 10)
m_delegate2();
if (i == 20)
break;
}
tw.Close();
}
}

} // end of namespace

Oct 19 '06 #5
Willy,

thnks for your help. Just posted a second ago. You must have
answered whilst I was composing it. However, using my new sample and
BEGINinvoke worked perfectly.

I am about to read more on this, but if you have time and can explain
it briefly, why would anyone use InvokeRequired/Invoke() like I have if
Invoke is asynchronous - it blocks the threads stopping my
multithreaded intention.

Warmest Regards

Willy Denoyette [MVP] wrote:
<k.******@iee.o rgwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
| Willy,
|
| many thanks for your reply. I fully understand your answer. Perhpas
| I am not stating the task clearly enough. I have deliberately put the
| GUI thread to sleep to illustrate the problem I want to solve. Evn
| though the GUI thread is alseep, I would still expect the worker thread
| to continue executing.
|
| So if the GUI thread thread sleeps for 20 seconds, and the worker
| ticks over once a second, I would expect the worker to hit a breakpoint
| (loop) 20 times whilst the GUI is asleep.
|
| However, the worker thread seems to get blocked. I appreciate that
| whilst the gui is sleeping the label will not get updated, but
| shouldn't the 20 worker thread loops get queued?
No, because you call Invoke, which is synchronous, which means it wait's
until the posted message (and the associated delegate) has been handled.
You need to call the asynchronous version BeginInvoke instead.
Sorry if I wasn't entirely clear in my previous answer.

Willy.
Oct 19 '06 #6
Note I referred to Invoke as asynchronous - I meant synchronous. Must
be coffee time :D

k.mel...@iee.or g wrote:
Willy,

thnks for your help. Just posted a second ago. You must have
answered whilst I was composing it. However, using my new sample and
BEGINinvoke worked perfectly.

I am about to read more on this, but if you have time and can explain
it briefly, why would anyone use InvokeRequired/Invoke() like I have if
Invoke is asynchronous - it blocks the threads stopping my
multithreaded intention.

Warmest Regards

Willy Denoyette [MVP] wrote:
<k.******@iee.o rgwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
| Willy,
|
| many thanks for your reply. I fully understand your answer. Perhpas
| I am not stating the task clearly enough. I have deliberately put the
| GUI thread to sleep to illustrate the problem I want to solve. Evn
| though the GUI thread is alseep, I would still expect the worker thread
| to continue executing.
|
| So if the GUI thread thread sleeps for 20 seconds, and the worker
| ticks over once a second, I would expect the worker to hit a breakpoint
| (loop) 20 times whilst the GUI is asleep.
|
| However, the worker thread seems to get blocked. I appreciate that
| whilst the gui is sleeping the label will not get updated, but
| shouldn't the 20 worker thread loops get queued?
No, because you call Invoke, which is synchronous, which means it wait's
until the posted message (and the associated delegate) has been handled.
You need to call the asynchronous version BeginInvoke instead.
Sorry if I wasn't entirely clear in my previous answer.

Willy.
Oct 19 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8883
by: David Logan | last post by:
I have an application using sockets, and it uses the asynchronous method for receiving (and others, but receiving is the basic problem.) In short, I want: class someClass: Form { mySocketClass sss; ...
19
6738
by: trint | last post by:
Ok, I start my thread job: Thread t = new Thread(new ThreadStart(invoicePrintingLongRunningCodeThread)); t.IsBackground = true; t.Start(); There are lots of calls to controls and many happen in function calls from invoicePrintingLongRunningCodeThread. I need just an example in
4
3584
by: Charles Law | last post by:
Hi guys. I have two threads: a main thread and a background thread. Lots of stuff happens in the background thread that means I have to update several (lots) of controls on a form. It is quite tiresome to have to write code to call MyControl.Invoke for each control on the form, along with the delegates that are required for each. Is there a better way to do this? What I mean is, if I could marshal the
7
2130
by: Jeff Stewart | last post by:
I need a thread to run a subroutine which updates my main form's progress bar. I've properly marshaled all UI updates to the main UI thread, and after the main thread starts the worker thread, it waits for the worker thread to complete by means of a while t.isAlive, sleep(0) mechanism. But when my worker thread calls my UpdateProgressBar routine, which calls Me.Invoke, the invoke call blocks forever. But I can't figure out why the main...
1
4219
by: Steve | last post by:
I need to update my UI from a Process or worker thread. I did some readinf and basically ended up adapting an MS example to fot my needs. It all made sense until I tried it :) My process makes calls to a Singleton logger class which in turn makes calls to a delegate to add items to a listbox in my WinForm. Here is the code that I have in my Form class to log output <code> delegate void AddOutputItem(string msg);
23
2646
by: Thomas Due | last post by:
Hi, I have a class which monitors a TCP socket. This will on occasion raise an event which can be handled by a GUI. Now, I am aware of the if(InvokeRequire) { EventHandler d = new EventHandler(); Invoke(d, new object{sender, e}); } else {
8
5570
by: Jothishankar | last post by:
Hi, I am new to c#. I am trying to build an application that does backup of files to an external hard disk. My application behaves strangely. When i run the application under debug mode (F5), it works properly. But when i run it in normal mode (Ctrl+F5) the program stalls in the middle. I use a couple of worker threads which run successively. The first one
2
4426
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small or simple). I am hoping the description will generate some ideas I can check out. PROBLEM: ----------------- Switching to UI thread using Invoke(), everything seems good.
3
2389
by: cwinay | last post by:
Hey guys, I couldn't find a dedicated hardware section here so I picked this section to ask my question assuming that system administrators of all kind hit this forum. Guide me to an appropriate section if possible. My computer abruptly stalls. I've dual boot with Windows XP Professional and Ubuntu 9.x XP has become slow to load, login and responds to clicks/keyboard events. After sometime it just stops responding but there is always some...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2870
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.