190 Topics
| |
Hey everyone, I've been struggling with this problem for hours now and I have read and tried every example I could find but did not find a solution to my problem: I have a DLL written in C#. The DLL export function calls three functions: PrepareData(): Heavy calculations ComputeNN(): Mild … | |
I'm trying to do the third writer/reader problem with semaphore (as mention on wiki). But it's not working properly. First 16-element array seem to work properly. But after first, it got wrong. Even though I think I'm almost there, I can't find the error at all. My code is as … | |
I don't get it why my threads can't perform properly for writer/reader problem. I think something with the semaphore. but can't solve and online can't help me too. [CODE] semaphore mutex, read, write; void *reader(void *argv) { char buffer[200]; int readNo, i=0; do { sem_wait(&read); sem_wait(&mutex); sem_getvalue(&read, &readNo); fgets(buffer, sizeof(buffer), … | |
I have written a code for checking vfork in unix. But I am getting the ambiguous behavious. When I am using exit(0) in child process , output is fine i.e; output :- Before fork I am a child My name is parent child PID=> 23133 kValue => 2 ] But … | |
Hi, I have a custom httphandler (HttpUploadHandler.ashx) which is used for handling requests from a file uploader. It collects all the files from a client then fires a thread to do some processing on the files. When large amounts of files are added it will throw 'Thread was being aborted' … | |
Hi. Guys, I need some help. Does anyone know how to Call cross threads in vb.net while accessing the backgroundworker as well? I keep getting error everytime I run my program... Here is my code: [CODE]Imports System.IO.Directory Imports System.IO Public Class Video_to_Mp3 Public folderopen As String Dim ofd As New … | |
Hello, first this is not a homework assignment so please respond whenever you have time as a speedy solution is not exactly needed. I have been learning C# recently from a microsoft book and had an idea of a program i want to make. Basically i want to be able … | |
I am learning concurrency programming, I try my best yet can't solve the problem [CODE] boost::mutex mut; std::vector<int> int_vector; boost::condition_variable int_cond; void data_preparation_thread() { while(int_vector.size() != 10) { std::cout<<"data preparation thread :: vector size = "<<int_vector.size()<<std::endl; boost::lock_guard<boost::mutex> lk(mut); int_vector.push_back(4); int_cond.notify_one(); } } void data_processing_thread() { while(1) { std::cout<<"front :: data … | |
I am trying to run the following code in a thread but I keep getting this error: [QUOTE][QUOTE]Cross-thread operation not valid[/QUOTE][/QUOTE] for both listboxes. Heres the code I am using: [CODE] try { for (int i = 0; i < listBox4.Items.Count; i++) { listBox4.SetSelected(i, true); listBox5.SetSelected(i, true); listBox4.SelectedItem.ToString(); string[] details … | |
[CODE]class MyThread1 implements Runnable { Thread t; MyThread1() { t = new Thread(this);//create a Thread t.start();//activate the thread } public void run() //override run() of Runnable { int i; for(i =0; i< 1000; i++) System.out.print("*"); } public static void main(String args[]) { MyThread1 m1 = new MyThread1(); int i; for(i … | |
[CODE]import os import urllib from datetime import datetime import workerpool class DownloadJob(workerpool.Job): def __init__(self, fa): self.fa = fa def run(self): f = open(self.fa + '.txt','w') f.write('Example Note.......') f.close() pool = workerpool.WorkerPool(size=5) def workfile(): range1 = 51 range2 = 102 fam1 = 555 fam2 = 833 ranges = range2 -range1 fams … | |
Hi, There is a small blogging system where a user posts small blogs and they are time stamped, if this system was expanded into a distributed environment the main issue I can for see is with so many people using the system then posts will go out off order, the … | |
I want to have two threads with a queue exchanging data (in the form of lists) between the two threads. However, at the moment I cannot fathom out how to write the code simply for taking the first list from the queue, processing it(which I have written the function for) … | |
hi, i put together this code to read a text file line by line, split the resulting string into the 4 values and send these values to four text-boxes. during each cycle of that while loop it's suppose to initialize the backgroundworker_dowork, which will read the values and use them(and … | |
Hello Friends, I have 6 to 7 threads which are running parallely. Thing is I have to put Thread.Sleep() between each threads. How Can I optimize it? [CODE]else if (__selectedString.equals("Master DataInput")) { try { if (RecordStore.listRecordStores() != null) { System.out.println("IT FOUND RECORDSTORE ......"); RecordStore.deleteRecordStore("Company"); RecordStore.deleteRecordStore("Product"); RecordStore.deleteRecordStore("Model"); RecordStore.deleteRecordStore("Customer"); RecordStore.deleteRecordStore("Sales"); System.out.println("Delete All … | |
I have a form let's call it Form1 that calls another form(Form2) Form2 to has a bit a code that needs to load in the LOAD_EVENT and takes about 4 seconds. I have made a new form(frmProgress) that only has a progress bar. I want frmProgress to show up and … | |
I'm using sockets in C to write 10 bytes to a socket and then read 10 bytes from that socket. I create a parent process that forks, creating a child that acts as the socket server that writes the 10 bytes. After the 10 bytes are wrote, back in the … | |
I need to tackle the question of threading in Visual C# application development. In its most basic use, I will need to "branch out" to SQL SPs (for example), but need to be able to inform the user that "I'm doing something" - such as the following outline: 1- user … | |
Hi, Trying to get this bit of code to work so that a train goes up the track, leaves the track and then a train comes down the track, leaves and then a train comes up the track and so on. Only one train is allowed to go onto the … | |
My understanding of this subject is - Two or more processes accessing a semaphore concurrently can cause Deadlock The provelms with semaphores is that you can forget to call the release method and it can cause deadlock Starvation Both processes can change the P and V counters of the semaphore … | |
Hi, I am working on a project which requires to update a JEditorPane or JTextField simultaneously by multiple clients. It is something like this. [B][1]. There are several users( i.e a group) with the same application which contains a JEditorPane. [2]. There is a group leader for a group( note: … | |
I have a multi-threaded application using over 500 threads and I want to log certain things that go on inside these threads to a single log text file, however not all the threads can access the file at the same time so how can I do this? The only way … | |
Hello, I've got a problem with simultaneous placement of an order in a webshop. I will start off with a general description of the problem, and provide details after that. **The problem** Orders are stored in the table 'orders'. Each order has a BillNumber, which is obtained via a mysql … | |
In the name of God my IDE is visual studio 2010 (c#) I want to create 3 threads for 3 sort(bubble sort,quick sort & merge sort) to show which function sort quickly? for showing this I make 3 array of buttons(for every func. 1 arr) & I want to sort … | |
Hi, I want to write thread function myself and don't want to use boost or AfxBeginThread(). Oh, and it works in /MD[d], /MD, MFX. Thanks a lot DestinyChanger | |
Hi Guys, I am developing a VB application along with MS Access... When I initially load my form I need to put my application to sleep for 3 seconds or else data wont load properly. So for this 3 seconds I would like to show a progress bar displaying a … | |
| Hi all, I am currently trying (and now wondering if) you can add multiple threads to a program to do the same job? Basically I am writing a web crawler for a search engine and it adds many URLs to an ArrayList which is used as a queue. I add … |
"Cross-thread operation not valid: Control 'DataGridView1' accessed from a thread other than the thread it was created on." I've been avoiding multithreading because of this since I started with vb.net a couple of weeks ago but it looks like I have to start using it now. I simply don't understand … | |
Hi folks, Please forgive a bit of a n00b question, but I'm working with the SwingWorker class and want to create a subclass of this which includes an input type, as well as the existing output and progress-message types (so basically I'd have "CTSwingWorker< I, O, M >"). Now, I'm … | |
Hello everyone I am new to this site. I have a university assignment in which I need to program a 2 player pacman game, using C and the Unix operating system. If more than 2 users have typed the command to run the program/s the users must wait in FIFO … |
The End.