mirror of
https://github.com/intel/llvm.git
synced 2026-01-24 17:01:00 +08:00
Add file-based synching to places missed in r350247.
llvm-svn: 350266
This commit is contained in:
@@ -31,14 +31,14 @@ class TestQueues(TestBase):
|
||||
self.main_source = "main.c"
|
||||
|
||||
def remove_token(self, name):
|
||||
for i in range(6):
|
||||
token = name+'.token.%d'%(i+1)
|
||||
for i in range(7):
|
||||
token = name+'.token.%d'%i
|
||||
if os.path.exists(token):
|
||||
os.remove(token)
|
||||
|
||||
def await_token(self, name):
|
||||
for i in range(6):
|
||||
lldbutil.wait_for_file_on_target(self, name+'.token.%d'%(i+1))
|
||||
for i in range(7):
|
||||
lldbutil.wait_for_file_on_target(self, name+'.token.%d'%i)
|
||||
|
||||
def check_queue_for_valid_queue_id(self, queue):
|
||||
self.assertTrue(
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
int finished_enqueueing_work = 0;
|
||||
char *name = NULL;
|
||||
|
||||
void
|
||||
touch (const char *name, unsigned n)
|
||||
@@ -23,6 +24,7 @@ touch (const char *name, unsigned n)
|
||||
void
|
||||
doing_the_work_1(void *in)
|
||||
{
|
||||
touch (name, 0);
|
||||
while (1)
|
||||
sleep (1);
|
||||
}
|
||||
@@ -94,6 +96,9 @@ stopper ()
|
||||
|
||||
int main (int argc, const char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
return 2;
|
||||
name = argv[1];
|
||||
dispatch_queue_t work_submittor_1 = dispatch_queue_create ("com.apple.work_submittor_1", DISPATCH_QUEUE_SERIAL);
|
||||
dispatch_queue_t work_submittor_2 = dispatch_queue_create ("com.apple.work_submittor_and_quit_2", DISPATCH_QUEUE_SERIAL);
|
||||
dispatch_queue_t work_submittor_3 = dispatch_queue_create ("com.apple.work_submittor_3", DISPATCH_QUEUE_SERIAL);
|
||||
@@ -115,37 +120,37 @@ int main (int argc, const char **argv)
|
||||
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0), ^{
|
||||
pthread_setname_np ("user initiated QoS");
|
||||
touch(argv[1], 1);
|
||||
touch(name, 1);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||
pthread_setname_np ("user interactive QoS");
|
||||
touch(argv[1], 2);
|
||||
touch(name, 2);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_DEFAULT, 0), ^{
|
||||
pthread_setname_np ("default QoS");
|
||||
touch(argv[1], 3);
|
||||
touch(name, 3);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^{
|
||||
pthread_setname_np ("utility QoS");
|
||||
touch(argv[1], 4);
|
||||
touch(name, 4);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
|
||||
pthread_setname_np ("background QoS");
|
||||
touch(argv[1], 5);
|
||||
touch(name, 5);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
dispatch_async (dispatch_get_global_queue(QOS_CLASS_UNSPECIFIED, 0), ^{
|
||||
pthread_setname_np ("unspecified QoS");
|
||||
touch(argv[1], 6);
|
||||
touch(name, 6);
|
||||
while (1)
|
||||
sleep (10);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user