?
Solved

sleeping problems

Posted on 2004-08-28
10
Medium Priority
?
411 Views
Last Modified: 2008-01-09
I'm using both javascript and vbscript in my asp.  My modules go something like this...
----------------------------------------------------------
<%@ Language = javascript %>
<%
  Pause();
%>

<SCRIPT LANGUAGE="VBScript" RUNAT="SERVER">
Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)
Function Pause()
  Sleep 3000
End Function
</SCRIPT>
---------------------------------------------------

This results in ...
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/iba/test1.asp, line 7, column 16
Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)

If I remove 'Private Declare Sub Sleep Lib "kernel32" (ByVal ms As Long)' I get...
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'Sleep'

Where did I go wrong and what's the solution?  If the solution includes building a new component I may require help in doing so.
0
Comment
Question by:Bob3975
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
10 Comments
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11921835
This is a very bad idea. You are much better off programming in such a way that you don't need to invoke the sleep method.

FtB
0
 

Author Comment

by:Bob3975
ID: 11921891
I'm doing this for testing.  I need to test timing issues by forcing a thread to stop in a critical position without eating up the processor.  I'm assuming that's not bad.  If it is, why?  If not, how can it be done?
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11921910
For timing, I usually do:

<%
response.write Now()
%>

Do your stuff

<%
response.write Now()
%>

Then you will know how much time has passed.

The problem with Sleep is that you never know for certain how long the event your waiting for is going to take, so it is best to program around that.

FtB
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Bob3975
ID: 11921944
That doesn't trap the thread in the critical area.  Here's what I'm trying to test, it's more a knowledge builder for myself than anything.

There is a section of code in which I need to update the Application object.  If I set Application.Lock(), what happens to another thread if it tries reading or writing the appication object?  Is try/catch of use?  But most importantly answering those questions and how they are answered will lead to more questions.  It becomes an experience thing.  The best way to learn is through experiencing it.

Therefore it seems to me that I could test and learn if I could trap the thread, and that's why I'd like to force it to sleep.
0
 

Author Comment

by:Bob3975
ID: 11923009
I'm using Or http://www.serverobjects.com/products.htm#free, WaitFor 1.0.

No further assistance needed
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11923274
I hope that works out and good luck!

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11931067
Fine with me,

FtB
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 11931241
PAQ-ing the question and refunding 250  points

Thanks  fritz_the_blank

modulo

Community Support Moderator
Experts Exchange
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11931298
Modulo--

Thanks for closing this out.

FtB
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question